home *** CD-ROM | disk | FTP | other *** search
/ Kompuutteri K-CD 2002 #1 / K-CD_2002-01.iso / Delphi / INSTALL / program files / Borland / Delphi6 / Source / Rtl / Win / ShlObj.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2001-05-22  |  135.5 KB  |  3,440 lines

  1.  
  2. {*******************************************************}
  3. {                                                       }
  4. {       Borland Delphi Run-time Library                 }
  5. {       Win32 API Shell objects Interface Unit          }
  6. {                                                       }
  7. {       Copyright (c) 1985-1999, Microsoft Corporation  }
  8. {                                                       }
  9. {       Translator: Borland Software Corporation        }
  10. {                                                       }
  11. {*******************************************************}
  12.  
  13. unit ShlObj;
  14.  
  15. {$WEAKPACKAGEUNIT}
  16.  
  17. interface
  18.  
  19. uses Windows, ActiveX, CommCtrl, ShellAPI, RegStr, Messages, WinInet, UrlMon;
  20.  
  21. {$HPPEMIT '#include <ole2.h>'}
  22. {$HPPEMIT '#include <prsht.h>'}
  23. {$HPPEMIT '#include <commctrl.h>   // for LPTBBUTTON'}
  24. {$HPPEMIT '#include <shlguid.h>'}
  25. {$HPPEMIT '#include <shlobj.h>'}
  26.  
  27. {$HPPEMIT 'typedef System::DelphiInterface<IAdviseSink> _di_IAdviseSink;'}
  28. {$HPPEMIT 'typedef System::DelphiInterface<IShellBrowser> _di_IShellBrowser;'}
  29. {$HPPEMIT 'typedef System::DelphiInterface<IShellView> _di_IShellView;'}
  30. {$HPPEMIT 'typedef System::DelphiInterface<IContextMenu> _di_IContextMenu;'}
  31. {$HPPEMIT 'typedef System::DelphiInterface<IShellIcon> _di_IShellIcon;'}
  32. {$HPPEMIT 'typedef System::DelphiInterface<IShellFolder> _di_IShellFolder;'}
  33. {$HPPEMIT 'typedef System::DelphiInterface<IShellFolder2> _di_IShellFolder2;'}
  34. {$HPPEMIT 'typedef System::DelphiInterface<IShellDetails> _di_IShellDetails;'}
  35. {$HPPEMIT 'typedef System::DelphiInterface<IShellExtInit> _di_IShellExtInit;'}
  36. {$HPPEMIT 'typedef System::DelphiInterface<IShellPropSheetExt> _di_IShellPropSheetExt;'}
  37. {$HPPEMIT 'typedef System::DelphiInterface<IPersistFolder> _di_IPersistFolder;'}
  38. {$HPPEMIT 'typedef System::DelphiInterface<ICommDlgBrowser> _di_ICommDlgBrowser;'}
  39. {$HPPEMIT 'typedef System::DelphiInterface<IEnumIDList> _di_IEnumIDList;'}
  40. {$HPPEMIT 'typedef System::DelphiInterface<IFileViewerSite> _di_IFileViewerSite;'}
  41. {$HPPEMIT 'typedef System::DelphiInterface<IContextMenu2> _di_IContextMenu2;'}
  42. {$HPPEMIT 'typedef System::DelphiInterface<IShellView2> _di_IShellView2;'}
  43. {$HPPEMIT 'typedef System::DelphiInterface<INewShortcutHookA> _di_INewShortcutHookA;'}
  44. {$HPPEMIT 'typedef System::DelphiInterface<INewShortcutHookW> _di_INewShortcutHookW;'}
  45. {$HPPEMIT 'typedef System::DelphiInterface<IFileViewerA> _di_IFileViewerA;'}
  46. {$HPPEMIT 'typedef System::DelphiInterface<IFileViewerW> _di_IFileViewerW;'}
  47. {$HPPEMIT 'typedef System::DelphiInterface<IShellLinkA> _di_IShellLinkA;'}
  48. {$HPPEMIT 'typedef System::DelphiInterface<IShellLinkW> _di_IShellLinkW;'}
  49. {$HPPEMIT 'typedef System::DelphiInterface<IExtractIconA> _di_IExtractIconA;'}
  50. {$HPPEMIT 'typedef System::DelphiInterface<IExtractIconW> _di_IExtractIconW;'}
  51. {$HPPEMIT 'typedef System::DelphiInterface<IShellExecuteHookA> _di_IShellExecuteHookA;'}
  52. {$HPPEMIT 'typedef System::DelphiInterface<IShellExecuteHookW> _di_IShellExecuteHookW;'}
  53. {$HPPEMIT 'typedef System::DelphiInterface<ICopyHookA> _di_ICopyHookA;'}
  54. {$HPPEMIT 'typedef System::DelphiInterface<ICopyHookW> _di_ICopyHookW;'}
  55.  
  56. {$HPPEMIT '#ifdef UNICODE'}
  57. {$HPPEMIT 'typedef _di_INewShortcutHookW _di_INewShortcutHook;'}
  58. {$HPPEMIT 'typedef _di_IFileViewerW _di_IFileViewer;'}
  59. {$HPPEMIT 'typedef _di_IShellLinkW _di_IShellLink;'}
  60. {$HPPEMIT 'typedef _di_IExtractIconW _di_IExtractIcon;'}
  61. {$HPPEMIT 'typedef _di_IShellExecuteHookW _di_IShellExecuteHook;'}
  62. {$HPPEMIT 'typedef _di_ICopyHookW _di_ICopyHook;'}
  63. {$HPPEMIT '#else'}
  64. {$HPPEMIT 'typedef _di_INewShortcutHookA _di_INewShortcutHook;'}
  65. {$HPPEMIT 'typedef _di_IFileViewerA _di_IFileViewer;'}
  66. {$HPPEMIT 'typedef _di_IShellLinkA _di_IShellLink;'}
  67. {$HPPEMIT 'typedef _di_IExtractIconA _di_IExtractIcon;'}
  68. {$HPPEMIT 'typedef _di_IShellExecuteHookA _di_IShellExecuteHook;'}
  69. {$HPPEMIT 'typedef _di_ICopyHookA _di_ICopyHook;'}
  70. {$HPPEMIT '#endif'}
  71.  
  72. { Object identifiers in the explorer's name space (ItemID and IDList)
  73.   All the items that the user can browse with the explorer (such as files,
  74.   directories, servers, work-groups, etc.) has an identifier which is unique
  75.   among items within the parent folder. Those identifiers are called item
  76.   IDs (SHITEMID). Since all its parent folders have their own item IDs,
  77.   any items can be uniquely identified by a list of item IDs, which is called
  78.   an ID list (ITEMIDLIST).
  79.  
  80.   ID lists are almost always allocated by the task allocator (see some
  81.   description below as well as OLE 2.0 SDK) and may be passed across
  82.   some of shell interfaces (such as IShellFolder). Each item ID in an ID list
  83.   is only meaningful to its parent folder (which has generated it), and all
  84.   the clients must treat it as an opaque binary data except the first two
  85.   bytes, which indicates the size of the item ID.
  86.  
  87.   When a shell extension -- which implements the IShellFolder interace --
  88.   generates an item ID, it may put any information in it, not only the data
  89.   with that it needs to identifies the item, but also some additional
  90.   information, which would help implementing some other functions efficiently.
  91.   For example, the shell's IShellFolder implementation of file system items
  92.   stores the primary (long) name of a file or a directory as the item
  93.   identifier, but it also stores its alternative (short) name, size and date
  94.   etc.
  95.  
  96.   When an ID list is passed to one of shell APIs (such as SHGetPathFromIDList),
  97.   it is always an absolute path -- relative from the root of the name space,
  98.   which is the desktop folder. When an ID list is passed to one of IShellFolder
  99.   member function, it is always a relative path from the folder (unless it
  100.   is explicitly specified). }
  101.  
  102. const
  103. // Class IDs        xx=00-9F
  104.   {$EXTERNALSYM CLSID_ShellDesktop}
  105.   CLSID_ShellDesktop: TGUID = (
  106.     D1:$00021400; D2:$0000; D3:$0000; D4:($C0,$00,$00,$00,$00,$00,$00,$46));
  107.   {$EXTERNALSYM CLSID_ShellLink}
  108.   CLSID_ShellLink: TGUID = (
  109.     D1:$00021401; D2:$0000; D3:$0000; D4:($C0,$00,$00,$00,$00,$00,$00,$46));
  110.   CLSID_ActiveDesktop: TGUID = '{75048700-EF1F-11D0-9888-006097DEACF9}';
  111.  
  112. // Format IDs       xx=A0-CF
  113.   {$EXTERNALSYM FMTID_Intshcut}
  114.   FMTID_Intshcut: TGUID = (
  115.     D1:$000214A0; D2:$0000; D3:$0000; D4:($C0,$00,$00,$00,$00,$00,$00,$46));
  116.   {$EXTERNALSYM FMTID_InternetSite}
  117.   FMTID_InternetSite: TGUID = (
  118.     D1:$000214A1; D2:$0000; D3:$0000; D4:($C0,$00,$00,$00,$00,$00,$00,$46));
  119.  
  120. // command group ids xx=D0-DF
  121.   {$EXTERNALSYM CGID_Explorer}
  122.   CGID_Explorer: TGUID = (
  123.     D1:$000214D0; D2:$0000; D3:$0000; D4:($C0,$00,$00,$00,$00,$00,$00,$46));
  124.   {$EXTERNALSYM CGID_ShellDocView}
  125.   CGID_ShellDocView: TGUID = (
  126.     D1:$000214D1; D2:$0000; D3:$0000; D4:($C0,$00,$00,$00,$00,$00,$00,$46));
  127.  
  128. // Interface IDs    xx=E0-FF
  129.   {$EXTERNALSYM IID_INewShortcutHookA}
  130.   IID_INewShortcutHookA: TGUID = (
  131.     D1:$000214E1; D2:$0000; D3:$0000; D4:($C0,$00,$00,$00,$00,$00,$00,$46));
  132.   {$EXTERNALSYM IID_IShellBrowser}
  133.   IID_IShellBrowser: TGUID = (
  134.     D1:$000214E2; D2:$0000; D3:$0000; D4:($C0,$00,$00,$00,$00,$00,$00,$46));
  135.   {$EXTERNALSYM IID_IShellView}
  136.   IID_IShellView: TGUID = (
  137.     D1:$000214E3; D2:$0000; D3:$0000; D4:($C0,$00,$00,$00,$00,$00,$00,$46));
  138.   {$EXTERNALSYM IID_IContextMenu}
  139.   IID_IContextMenu: TGUID = (
  140.     D1:$000214E4; D2:$0000; D3:$0000; D4:($C0,$00,$00,$00,$00,$00,$00,$46));
  141.   {$EXTERNALSYM IID_IShellIcon}
  142.   IID_IShellIcon: TGUID = (
  143.     D1:$000214E5; D2:$0000; D3:$0000; D4:($C0,$00,$00,$00,$00,$00,$00,$46));
  144.   {$EXTERNALSYM IID_IShellFolder}
  145.   IID_IShellFolder: TGUID = (
  146.     D1:$000214E6; D2:$0000; D3:$0000; D4:($C0,$00,$00,$00,$00,$00,$00,$46));
  147.   {$EXTERNALSYM IID_IShellExtInit}
  148.   IID_IShellExtInit: TGUID = (
  149.     D1:$000214E8; D2:$0000; D3:$0000; D4:($C0,$00,$00,$00,$00,$00,$00,$46));
  150.   {$EXTERNALSYM IID_IShellPropSheetExt}
  151.   IID_IShellPropSheetExt: TGUID = (
  152.     D1:$000214E9; D2:$0000; D3:$0000; D4:($C0,$00,$00,$00,$00,$00,$00,$46));
  153.   {$EXTERNALSYM IID_IPersistFolder}
  154.   IID_IPersistFolder: TGUID = (
  155.     D1:$000214EA; D2:$0000; D3:$0000; D4:($C0,$00,$00,$00,$00,$00,$00,$46));
  156.   {$EXTERNALSYM IID_IExtractIconA}
  157.   IID_IExtractIconA: TGUID = (
  158.     D1:$000214EB; D2:$0000; D3:$0000; D4:($C0,$00,$00,$00,$00,$00,$00,$46));
  159.   {$EXTERNALSYM IID_IShellLinkA}
  160.   IID_IShellLinkA: TGUID = (
  161.     D1:$000214EE; D2:$0000; D3:$0000; D4:($C0,$00,$00,$00,$00,$00,$00,$46));
  162.   {$EXTERNALSYM IID_IShellCopyHookA}
  163.   IID_IShellCopyHookA: TGUID = (
  164.     D1:$000214EF; D2:$0000; D3:$0000; D4:($C0,$00,$00,$00,$00,$00,$00,$46));
  165.   {$EXTERNALSYM IID_IFileViewerA}
  166.   IID_IFileViewerA: TGUID = (
  167.     D1:$000214F0; D2:$0000; D3:$0000; D4:($C0,$00,$00,$00,$00,$00,$00,$46));
  168.   {$EXTERNALSYM IID_ICommDlgBrowser}
  169.   IID_ICommDlgBrowser: TGUID = (
  170.     D1:$000214F1; D2:$0000; D3:$0000; D4:($C0,$00,$00,$00,$00,$00,$00,$46));
  171.   {$EXTERNALSYM IID_IEnumIDList}
  172.   IID_IEnumIDList: TGUID = (
  173.     D1:$000214F2; D2:$0000; D3:$0000; D4:($C0,$00,$00,$00,$00,$00,$00,$46));
  174.   {$EXTERNALSYM IID_IFileViewerSite}
  175.   IID_IFileViewerSite: TGUID = (
  176.     D1:$000214F3; D2:$0000; D3:$0000; D4:($C0,$00,$00,$00,$00,$00,$00,$46));
  177.   {$EXTERNALSYM IID_IContextMenu2}
  178.   IID_IContextMenu2: TGUID = (
  179.     D1:$000214F4; D2:$0000; D3:$0000; D4:($C0,$00,$00,$00,$00,$00,$00,$46));
  180.   {$EXTERNALSYM IID_IShellExecuteHook}
  181.   IID_IShellExecuteHook: TGUID = (
  182.     D1:$000214F5; D2:$0000; D3:$0000; D4:($C0,$00,$00,$00,$00,$00,$00,$46));
  183.   {$EXTERNALSYM IID_IPropSheetPage}
  184.   IID_IPropSheetPage: TGUID = (
  185.     D1:$000214F6; D2:$0000; D3:$0000; D4:($C0,$00,$00,$00,$00,$00,$00,$46));
  186.   {$EXTERNALSYM IID_INewShortcutHookW}
  187.   IID_INewShortcutHookW: TGUID = (
  188.     D1:$000214F7; D2:$0000; D3:$0000; D4:($C0,$00,$00,$00,$00,$00,$00,$46));
  189.   {$EXTERNALSYM IID_IFileViewerW}
  190.   IID_IFileViewerW: TGUID = (
  191.     D1:$000214F8; D2:$0000; D3:$0000; D4:($C0,$00,$00,$00,$00,$00,$00,$46));
  192.   {$EXTERNALSYM IID_IShellLinkW}
  193.   IID_IShellLinkW: TGUID = (
  194.     D1:$000214F9; D2:$0000; D3:$0000; D4:($C0,$00,$00,$00,$00,$00,$00,$46));
  195.   {$EXTERNALSYM IID_IExtractIconW}
  196.   IID_IExtractIconW: TGUID = (
  197.     D1:$000214FA; D2:$0000; D3:$0000; D4:($C0,$00,$00,$00,$00,$00,$00,$46));
  198.   {$EXTERNALSYM IID_IShellExecuteHookW}
  199.   IID_IShellExecuteHookW: TGUID = (
  200.     D1:$000214FB; D2:$0000; D3:$0000; D4:($C0,$00,$00,$00,$00,$00,$00,$46));
  201.   {$EXTERNALSYM IID_IShellCopyHookW}
  202.   IID_IShellCopyHookW: TGUID = (
  203.     D1:$000214FC; D2:$0000; D3:$0000; D4:($C0,$00,$00,$00,$00,$00,$00,$46));
  204.   {$EXTERNALSYM IID_IShellView2}
  205.   IID_IShellView2: TGUID = (
  206.     D1:$88E39E80; D2:$3578; D3:$11CF; D4:($AE,$69,$08,$00,$2B,$2E,$12,$62));
  207.   {$EXTERNALSYM IID_IShellFolder2}
  208.   IID_IShellFolder2: TGUID = (
  209.     D1:$B82C5AA8; D2:$A41B; D3:$11D2; D4:($BE,$32,$00,$C0,$4F,$B9,$36,$61));
  210.   {$EXTERNALSYM IID_IShellDetails}
  211.   IID_IShellDetails: TGUID = (
  212.     D1:$000214EC; D2:$0000; D3:$0000; D4:($C0,$00,$00,$00,$00,$00,$00,$46));
  213.   {$EXTERNALSYM IID_IEnumExtraSearch}
  214.   IID_IEnumExtraSearch: TGUID = (
  215.     D1:$E700BE1; D2: $9DB6; D3:$11D1; D4:($A1,$CE,$00,$C0,$4F,$D7,$5D,$13));
  216.  
  217.  
  218. // String constants for Interface IDs
  219.   SID_INewShortcutHookA  = '{000214E1-0000-0000-C000-000000000046}';
  220.   SID_IShellBrowser      = '{000214E2-0000-0000-C000-000000000046}';
  221.   SID_IShellView         = '{000214E3-0000-0000-C000-000000000046}';
  222.   SID_IContextMenu       = '{000214E4-0000-0000-C000-000000000046}';
  223.   SID_IShellIcon         = '{000214E5-0000-0000-C000-000000000046}';
  224.   SID_IShellFolder       = '{000214E6-0000-0000-C000-000000000046}';
  225.   SID_IShellExtInit      = '{000214E8-0000-0000-C000-000000000046}';
  226.   SID_IShellPropSheetExt = '{000214E9-0000-0000-C000-000000000046}';
  227.   SID_IPersistFolder     = '{000214EA-0000-0000-C000-000000000046}';
  228.   SID_IExtractIconA      = '{000214EB-0000-0000-C000-000000000046}';
  229.   SID_IShellLinkA        = '{000214EE-0000-0000-C000-000000000046}';
  230.   SID_IShellCopyHookA    = '{000214EF-0000-0000-C000-000000000046}';
  231.   SID_IFileViewerA       = '{000214F0-0000-0000-C000-000000000046}';
  232.   SID_ICommDlgBrowser    = '{000214F1-0000-0000-C000-000000000046}';
  233.   SID_IEnumIDList        = '{000214F2-0000-0000-C000-000000000046}';
  234.   SID_IFileViewerSite    = '{000214F3-0000-0000-C000-000000000046}';
  235.   SID_IContextMenu2      = '{000214F4-0000-0000-C000-000000000046}';
  236.   SID_IShellExecuteHookA = '{000214F5-0000-0000-C000-000000000046}';
  237.   SID_IPropSheetPage     = '{000214F6-0000-0000-C000-000000000046}';
  238.   SID_INewShortcutHookW  = '{000214F7-0000-0000-C000-000000000046}';
  239.   SID_IFileViewerW       = '{000214F8-0000-0000-C000-000000000046}';
  240.   SID_IShellLinkW        = '{000214F9-0000-0000-C000-000000000046}';
  241.   SID_IExtractIconW      = '{000214FA-0000-0000-C000-000000000046}';
  242.   SID_IShellExecuteHookW = '{000214FB-0000-0000-C000-000000000046}';
  243.   SID_IShellCopyHookW    = '{000214FC-0000-0000-C000-000000000046}';
  244.   SID_IShellView2        = '{88E39E80-3578-11CF-AE69-08002B2E1262}';
  245.   SID_IContextMenu3      = '{BCFCE0A0-EC17-11d0-8D10-00A0C90F2719}';
  246.   SID_IPersistFolder2    = '{1AC3D9F0-175C-11d1-95BE-00609797EA4F}';
  247.   SID_IShellIconOverlayIdentifier = '{0C6C4200-C589-11D0-999A-00C04FD655E1}';
  248.   SID_IShellIconOverlay  = '{7D688A70-C613-11D0-999B-00C04FD655E1}';
  249.   SID_IURLSearchHook     = '{AC60F6A0-0FD9-11D0-99CB-00C04FD64497}';
  250.   SID_IInputObjectSite   = '{f1db8392-7331-11d0-8c99-00a0c92dbfe8}';
  251.   SID_IInputObject       = '{68284faa-6a48-11d0-8c78-00c04fd918b4}';
  252.   SID_IDockingWindowSite = '{2a342fc2-7b26-11d0-8ca9-00a0c92dbfe8}';
  253.   SID_IDockingWindowFrame = '{47d2657a-7b27-11d0-8ca9-00a0c92dbfe8}';
  254.   SID_IDockingWindow     = '{012dd920-7b26-11d0-8ca9-00a0c92dbfe8}';
  255.   SID_IDeskBand          = '{EB0FE172-1A3A-11D0-89B3-00A0C90A90AC}';
  256.   SID_IActiveDesktop     = '{F490EB00-1240-11D1-9888-006097DEACF9}';
  257.   SID_IShellChangeNotify = '{00000000-0000-0000-0000-000000000000}';  // !!
  258.   SID_IQueryInfo         = '{00021500-0000-0000-C000-000000000046}';
  259.   SID_IShellDetails      = '{000214EC-0000-0000-C000-000000000046}';
  260.   SID_IShellFolder2      = '{B82C5AA8-A41B-11D2-BE32-00C04FB93661}';
  261.   SID_IEnumExtraSearch   = '{0E700BE1-9DB6-11D1-A1CE-00C04FD75D13}';
  262.   
  263. type
  264. { TSHItemID -- Item ID }
  265.   PSHItemID = ^TSHItemID;
  266.   {$EXTERNALSYM _SHITEMID}
  267.   _SHITEMID = record
  268.     cb: Word;                         { Size of the ID (including cb itself) }
  269.     abID: array[0..0] of Byte;        { The item ID (variable length) }
  270.   end;
  271.   TSHItemID = _SHITEMID;
  272.   {$EXTERNALSYM SHITEMID}
  273.   SHITEMID = _SHITEMID;
  274.  
  275.  
  276. { TItemIDList -- List if item IDs (combined with 0-terminator) }
  277.   PItemIDList = ^TItemIDList;
  278.   {$EXTERNALSYM _ITEMIDLIST}
  279.   _ITEMIDLIST = record
  280.      mkid: TSHItemID;
  281.    end;
  282.   TItemIDList = _ITEMIDLIST;
  283.   {$EXTERNALSYM ITEMIDLIST}
  284.   ITEMIDLIST = _ITEMIDLIST;
  285.  
  286.  
  287. { Task allocator API }
  288.  
  289. { All the shell extensions MUST use the task allocator (see OLE 2.0
  290.  programming guild for its definition) when they allocate or free
  291.  memory objects (mostly ITEMIDLIST) that are returned across any
  292.  shell interfaces. There are two ways to access the task allocator
  293.  from a shell extension depending on whether or not it is linked with
  294.  OLE32.DLL or not (virtual; stdcall; abstractly for efficiency).
  295.  
  296.  (1) A shell extension which calls any OLE API (i.e., linked with
  297.   OLE32.DLL) should call OLE's task allocator (by retrieving
  298.   the task allocator by calling CoGetMalloc API).
  299.  
  300.  (2) A shell extension which does not call any OLE API (i.e., not linked
  301.   with OLE32.DLL) should call the shell task allocator API (defined
  302.   below), so that the shell can quickly loads it when OLE32.DLL is not
  303.   loaded by any application at that point. }
  304.  
  305. { !!! Notes:
  306.   In next version of Windowso release, SHGetMalloc will be replaced by
  307.  the following macro.
  308.  
  309.  #define SHGetMalloc(ppmem)     CoGetMalloc(MEMCTX_TASK, ppmem) }
  310.  
  311. {$EXTERNALSYM SHGetMalloc}
  312. function SHGetMalloc(var ppMalloc: IMalloc): HResult; stdcall;
  313.  
  314. { IContextMenu interface }
  315.  
  316. { [OverView] }
  317.  
  318. { The shell uses the IContextMenu interface in following three cases.
  319.  
  320.  case-1: The shell is loading context menu extensions.
  321.    When the user clicks the right mouse button on an item within the shell's
  322.   name space (i.g., file, directory, server, work-group, etc.), it creates
  323.   the default context menu for its type, then loads context menu extensions
  324.   that are registered for that type (and its base type) so that they can
  325.   add extra menu items. Those context menu extensions are registered at
  326.   HKCR\beginProgIDend\shellex\ContextMenuHandlers.
  327.  
  328.  case-2: The shell is retrieving a context menu of sub-folders in extended
  329.    name-space.
  330.    When the explorer's name space is extended by name space extensions,
  331.   the shell calls their IShellFolder::GetUIObjectOf to get the IContextMenu
  332.   objects when it creates context menus for folders under those extended
  333.   name spaces.
  334.  
  335.  case-3: The shell is loading non-default drag and drop handler for directories.
  336.    When the user performed a non-default drag and drop onto one of file
  337.   system folders (i.e., directories), it loads shell extensions that are
  338.   registered at HKCR\beginProgIDend\DragDropHandlers. }
  339.  
  340. { [Member functions] }
  341.  
  342. { IContextMenu::QueryContextMenu }
  343.  
  344. { This member function may insert one or more menuitems to the specified
  345.   menu (hmenu) at the specified location (indexMenu which is never be -1).
  346.   The IDs of those menuitem must be in the specified range (idCmdFirst and
  347.   idCmdLast). It returns the maximum menuitem ID offset (ushort) in the
  348.   'code' field (low word) of the scode.
  349.  
  350.   The uFlags specify the context. It may have one or more of following
  351.   flags.
  352.  
  353.   CMF_DEFAULTONLY: This flag is passed if the user is invoking the default
  354.   action (typically by double-clicking, case 1 and 2 only). Context menu
  355.   extensions (case 1) should not add any menu items, and returns NOERROR.
  356.  
  357.   CMF_VERBSONLY: The explorer passes this flag if it is constructing
  358.   a context menu for a short-cut object (case 1 and case 2 only). If this
  359.   flag is passed, it should not add any menu-items that is not appropriate
  360.   from a short-cut.
  361.   A good example is the 'Delete' menuitem, which confuses the user
  362.   because it is not clear whether it deletes the link source item or the
  363.   link itself.
  364.  
  365.   CMF_EXPLORER: The explorer passes this flag if it has the left-side pane
  366.    (case 1 and 2 only). Context menu extensions should ignore this flag.
  367.  
  368.   High word (16-bit) are reserved for context specific communications
  369.   and the rest of flags (13-bit) are reserved by the system. }
  370.  
  371.  
  372. { IContextMenu::InvokeCommand }
  373.  
  374. { This member is called when the user has selected one of menuitems that
  375.   are inserted by previous QueryContextMenu member. In this case, the
  376.   LOWORD(lpici->lpVerb) contains the menuitem ID offset (menuitem ID -
  377.   idCmdFirst).
  378.  
  379.    This member function may also be called programmatically. In such a case,
  380.   lpici->lpVerb specifies the canonical name of the command to be invoked,
  381.   which is typically retrieved by GetCommandString member previously.
  382.  
  383.   Parameters in lpci:
  384.     cbSize -- Specifies the size of this structure (sizeof(*lpci))
  385.     hwnd   -- Specifies the owner window for any message/dialog box.
  386.     fMask  -- Specifies whether or not dwHotkey/hIcon paramter is valid.
  387.     lpVerb -- Specifies the command to be invoked.
  388.     lpParameters -- Parameters (optional)
  389.     lpDirectory  -- Working directory (optional)
  390.     nShow -- Specifies the flag to be passed to ShowWindow (SW_*).
  391.     dwHotKey -- Hot key to be assigned to the app after invoked (optional).
  392.     hIcon -- Specifies the icon (optional).
  393.     hMonitor -- Specifies the default monitor (optional). }
  394.  
  395.  
  396. { IContextMenu::GetCommandString }
  397.  
  398. { This member function is called by the explorer either to get the
  399.   canonical (language independent) command name (uFlags == GCS_VERB) or
  400.   the help text ((uFlags & GCS_HELPTEXT) != 0) for the specified command.
  401.   The retrieved canonical string may be passed to its InvokeCommand
  402.   member function to invoke a command programmatically. The explorer
  403.   displays the help texts in its status bar; therefore, the length of
  404.   the help text should be reasonably short (<40 characters).
  405.  
  406.   Parameters:
  407.    idCmd -- Specifies menuitem ID offset (from idCmdFirst)
  408.    uFlags -- Either GCS_VERB or GCS_HELPTEXT
  409.    pwReserved -- Reserved (must pass NULL when calling, must ignore when called)
  410.    pszName -- Specifies the string buffer.
  411.    cchMax -- Specifies the size of the string buffer. }
  412.  
  413.  
  414. const
  415. { QueryContextMenu uFlags }
  416.  
  417.   {$EXTERNALSYM CMF_NORMAL}
  418.   CMF_NORMAL             = $00000000;
  419.   {$EXTERNALSYM CMF_DEFAULTONLY}
  420.   CMF_DEFAULTONLY        = $00000001;
  421.   {$EXTERNALSYM CMF_VERBSONLY}
  422.   CMF_VERBSONLY          = $00000002;
  423.   {$EXTERNALSYM CMF_EXPLORE}
  424.   CMF_EXPLORE            = $00000004;
  425.   {$EXTERNALSYM CMF_NOVERBS}
  426.   CMF_NOVERBS            = $00000008;
  427.   {$EXTERNALSYM CMF_CANRENAME}
  428.   CMF_CANRENAME          = $00000010;
  429.   {$EXTERNALSYM CMF_NODEFAULT}
  430.   CMF_NODEFAULT          = $00000020;
  431.   {$EXTERNALSYM CMF_INCLUDESTATIC}
  432.   CMF_INCLUDESTATIC      = $00000040;
  433.   {$EXTERNALSYM CMF_RESERVED}
  434.   CMF_RESERVED           = $FFFF0000;      { View specific }
  435.  
  436. { GetCommandString uFlags }
  437.  
  438.   {$EXTERNALSYM GCS_VERBA}
  439.   GCS_VERBA            = $00000000;     { canonical verb }
  440.   {$EXTERNALSYM GCS_HELPTEXTA}
  441.   GCS_HELPTEXTA        = $00000001;     { help text (for status bar) }
  442.   {$EXTERNALSYM GCS_VALIDATEA}
  443.   GCS_VALIDATEA        = $00000002;     { validate command exists }
  444.   {$EXTERNALSYM GCS_VERBW}
  445.   GCS_VERBW            = $00000004;     { canonical verb (unicode) }
  446.   {$EXTERNALSYM GCS_HELPTEXTW}
  447.   GCS_HELPTEXTW        = $00000005;     { help text (unicode version) }
  448.   {$EXTERNALSYM GCS_VALIDATEW}
  449.   GCS_VALIDATEW        = $00000006;     { validate command exists (unicode) }
  450.   {$EXTERNALSYM GCS_UNICODE}
  451.   GCS_UNICODE          = $00000004;     { for bit testing - Unicode string }
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.   {$EXTERNALSYM GCS_VERB}
  462.   GCS_VERB            = GCS_VERBA;
  463.   {$EXTERNALSYM GCS_HELPTEXT}
  464.   GCS_HELPTEXT        = GCS_HELPTEXTA;
  465.   {$EXTERNALSYM GCS_VALIDATE}
  466.   GCS_VALIDATE        = GCS_VALIDATEA;
  467.  
  468.  
  469.   {$EXTERNALSYM CMDSTR_NEWFOLDERA}
  470.   CMDSTR_NEWFOLDERA       = 'NewFolder';
  471.   {$EXTERNALSYM CMDSTR_VIEWLISTA}
  472.   CMDSTR_VIEWLISTA        = 'ViewList';
  473.   {$EXTERNALSYM CMDSTR_VIEWDETAILSA}
  474.   CMDSTR_VIEWDETAILSA     = 'ViewDetails';
  475.   {$EXTERNALSYM CMDSTR_NEWFOLDERW}
  476.   CMDSTR_NEWFOLDERW       = 'NewFolder'; // !!! make WideString() ?
  477.   {$EXTERNALSYM CMDSTR_VIEWLISTW}
  478.   CMDSTR_VIEWLISTW        = 'ViewList';
  479.   {$EXTERNALSYM CMDSTR_VIEWDETAILSW}
  480.   CMDSTR_VIEWDETAILSW     = 'ViewDetails';
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.   {$EXTERNALSYM CMDSTR_NEWFOLDER}
  491.   CMDSTR_NEWFOLDER        = CMDSTR_NEWFOLDERA;
  492.   {$EXTERNALSYM CMDSTR_VIEWLIST}
  493.   CMDSTR_VIEWLIST         = CMDSTR_VIEWLISTA;
  494.   {$EXTERNALSYM CMDSTR_VIEWDETAILS}
  495.   CMDSTR_VIEWDETAILS      = CMDSTR_VIEWDETAILSA;
  496.  
  497.  
  498.   {$EXTERNALSYM CMIC_MASK_HOTKEY}
  499.   CMIC_MASK_HOTKEY            = SEE_MASK_HOTKEY;
  500.   {$EXTERNALSYM CMIC_MASK_ICON}
  501.   CMIC_MASK_ICON              = SEE_MASK_ICON;
  502.   {$EXTERNALSYM CMIC_MASK_FLAG_NO_UI}
  503.   CMIC_MASK_FLAG_NO_UI        = SEE_MASK_FLAG_NO_UI;
  504.   {$EXTERNALSYM CMIC_MASK_UNICODE}
  505.   CMIC_MASK_UNICODE           = SEE_MASK_UNICODE;
  506.   {$EXTERNALSYM CMIC_MASK_NO_CONSOLE}
  507.   CMIC_MASK_NO_CONSOLE        = SEE_MASK_NO_CONSOLE;
  508. //  CMIC_MASK_HASLINKNAME       = SEE_MASK_HASLINKNAME; - not defined in shellapi
  509. //  CMIC_MASK_FLAG_SEP_VDM      = SEE_MASK_FLAG_SEPVDM; - not defined in shellapi
  510. //  CMIC_MASK_HASTITLE          = SEE_MASK_HASTITLE; - not defined in shellapi
  511.   {$EXTERNALSYM CMIC_MASK_ASYNCOK}
  512.   CMIC_MASK_ASYNCOK           = SEE_MASK_ASYNCOK;
  513.  
  514.   {$EXTERNALSYM CMIC_MASK_PTINVOKE}
  515.   CMIC_MASK_PTINVOKE          = $20000000;
  516.  
  517. type
  518.   // NOTE: When SEE_MASK_HMONITOR is set, hIcon is treated as hMonitor
  519.   PCMInvokeCommandInfo = ^TCMInvokeCommandInfo;
  520.   {$EXTERNALSYM _CMINVOKECOMMANDINFO}
  521.   _CMINVOKECOMMANDINFO = record
  522.     cbSize: DWORD;        { must be sizeof(CMINVOKECOMMANDINFO) }
  523.     fMask: DWORD;         { any combination of CMIC_MASK_* }
  524.     hwnd: HWND;           { might be NULL (indicating no owner window) }
  525.     lpVerb: LPCSTR;       { either a string of MAKEINTRESOURCE(idOffset) }
  526.     lpParameters: LPCSTR; { might be NULL (indicating no parameter) }
  527.     lpDirectory: LPCSTR;  { might be NULL (indicating no specific directory) }
  528.     nShow: Integer;       { one of SW_ values for ShowWindow() API }
  529.     dwHotKey: DWORD;
  530.     hIcon: THandle;
  531.   end;
  532.   TCMInvokeCommandInfo = _CMINVOKECOMMANDINFO;
  533.   {$EXTERNALSYM CMINVOKECOMMANDINFO}
  534.   CMINVOKECOMMANDINFO = _CMINVOKECOMMANDINFO;
  535.  
  536.   PCMInvokeCommandInfoEx = ^TCMInvokeCommandInfoEx;
  537.   {$EXTERNALSYM _CMInvokeCommandInfoEx}
  538.   _CMInvokeCommandInfoEx = record
  539.     cbSize: DWORD;       { must be sizeof(CMINVOKECOMMANDINFOEX) }
  540.     fMask: DWORD;        { any combination of CMIC_MASK_* }
  541.     hwnd: HWND;          { might be NULL (indicating no owner window) }
  542.     lpVerb: LPCSTR;      { either a string or MAKEINTRESOURCE(idOffset) }
  543.     lpParameters: LPCSTR;{ might be NULL (indicating no parameter) }
  544.     lpDirectory: LPCSTR; { might be NULL (indicating no specific directory) }
  545.     nShow: Integer;      { one of SW_ values for ShowWindow() API }
  546.     dwHotKey: DWORD;
  547.     hIcon: THandle;
  548.     lpTitle: LPCSTR;        { For CreateProcess-StartupInfo.lpTitle }
  549.     lpVerbW: LPCWSTR;       { Unicode verb (for those who can use it) }
  550.     lpParametersW: LPCWSTR; { Unicode parameters (for those who can use it) }
  551.     lpDirectoryW: LPCWSTR;  { Unicode directory (for those who can use it) }
  552.     lpTitleW: LPCWSTR;      { Unicode title (for those who can use it) }
  553.     ptInvoke: TPoint;       { Point where it's invoked }
  554.   end;
  555.   TCMInvokeCommandInfoEx = _CMINVOKECOMMANDINFOEX;
  556.   {$EXTERNALSYM CMINVOKECOMMANDINFOEX}
  557.   CMINVOKECOMMANDINFOEX = _CMINVOKECOMMANDINFOEX;
  558.  
  559.  
  560.   {$EXTERNALSYM IContextMenu}
  561.   IContextMenu = interface(IUnknown)
  562.     [SID_IContextMenu]
  563.     function QueryContextMenu(Menu: HMENU;
  564.       indexMenu, idCmdFirst, idCmdLast, uFlags: UINT): HResult; stdcall;
  565.     function InvokeCommand(var lpici: TCMInvokeCommandInfo): HResult; stdcall;
  566.     function GetCommandString(idCmd, uType: UINT; pwReserved: PUINT;
  567.       pszName: LPSTR; cchMax: UINT): HResult; stdcall;
  568.   end;
  569.  
  570. { IContextMenu2 (IContextMenu with one new member) }
  571. { IContextMenu2.HandleMenuMsg }
  572.  
  573. {  This function is called, if the client of IContextMenu is aware of }
  574. { IContextMenu2 interface and receives one of following messages while }
  575. { it is calling TrackPopupMenu (in the window proc of hwndOwner): }
  576. {      WM_INITPOPUP, WM_DRAWITEM and WM_MEASUREITEM }
  577. {  The callee may handle these messages to draw owner draw menuitems. }
  578.  
  579.   {$EXTERNALSYM IContextMenu2}
  580.   IContextMenu2 = interface(IContextMenu)
  581.     [SID_IContextMenu2]
  582.     function HandleMenuMsg(uMsg: UINT; WParam, LParam: Integer): HResult; stdcall;
  583.   end;
  584.  
  585. { IContextMenu3 (IContextMenu2 with one new member }
  586. { IContextMenu3::HandleMenuMsg2 }
  587.  
  588. {  This function is called, if the client of IContextMenu is aware of }
  589. { IContextMenu3 interface and receives a menu message while }
  590. { it is calling TrackPopupMenu (in the window proc of hwndOwner): }
  591.  
  592.   {$EXTERNALSYM IContextMenu3}
  593.   IContextMenu3 = interface(IContextMenu2)
  594.     [SID_IContextMenu3]
  595.     function HandleMenuMsg2(uMsg: UINT; wParam, lParam: Integer;
  596.       var lpResult: Integer): HResult; stdcall;
  597.   end;
  598.  
  599. { Interface: IShellExtInit }
  600.  
  601. { The IShellExtInit interface is used by the explorer to initialize shell
  602.   extension objects. The explorer (1) calls CoCreateInstance (or equivalent)
  603.   with the registered CLSID and IID_IShellExtInit, (2) calls its Initialize
  604.   member, then (3) calls its QueryInterface to a particular interface (such
  605.   as IContextMenu or IPropSheetExt and (4) performs the rest of operation. }
  606.  
  607. { [Member functions] }
  608.  
  609. { IShellExtInit.Initialize }
  610.  
  611. { This member function is called when the explorer is initializing either
  612.   context menu extension, property sheet extension or non-default drag-drop
  613.   extension.
  614.  
  615.   Parameters: (context menu or property sheet extension)
  616.    pidlFolder -- Specifies the parent folder
  617.    lpdobj -- Spefifies the set of items selected in that folder.
  618.    hkeyProgID -- Specifies the type of the focused item in the selection.
  619.  
  620.   Parameters: (non-default drag-and-drop extension)
  621.    pidlFolder -- Specifies the target (destination) folder
  622.    lpdobj -- Specifies the items that are dropped (see the description
  623.     about shell's clipboard below for clipboard formats).
  624.    hkeyProgID -- Specifies the folder type. }
  625.  
  626. type
  627.   {$EXTERNALSYM IShellExtInit}
  628.   IShellExtInit = interface(IUnknown)
  629.     [SID_IShellExtInit]
  630.     function Initialize(pidlFolder: PItemIDList; lpdobj: IDataObject;
  631.       hKeyProgID: HKEY): HResult; stdcall;
  632.   end;
  633.  
  634. {=========================================================================== }
  635.  
  636. { Interface: IShellPropSheetExt }
  637.  
  638. { The explorer uses the IShellPropSheetExt to allow property sheet
  639.   extensions or control panel extensions to add additional property
  640.   sheet pages. }
  641.  
  642. { [Member functions] }
  643.  
  644. { IShellPropSheetExt.AddPages }
  645.  
  646. { The explorer calls this member function when it finds a registered
  647.   property sheet extension for a particular type of object. For each
  648.   additional page, the extension creates a page object by calling
  649.   CreatePropertySheetPage API and calls lpfnAddPage.
  650.  
  651.    Parameters:
  652.     lpfnAddPage -- Specifies the callback function.
  653.     lParam -- Specifies the opaque handle to be passed to the callback function. }
  654.  
  655.  
  656. { IShellPropSheetExt.ReplacePage }
  657.  
  658. { The explorer never calls this member of property sheet extensions. The
  659.   explorer calls this member of control panel extensions, so that they
  660.   can replace some of default control panel pages (such as a page of
  661.   mouse control panel).
  662.  
  663.    Parameters:
  664.     uPageID -- Specifies the page to be replaced.
  665.     lpfnReplace Specifies the callback function.
  666.     lParam -- Specifies the opaque handle to be passed to the callback function. }
  667.  
  668. type
  669.   {$EXTERNALSYM IShellPropSheetExt}
  670.   IShellPropSheetExt = interface(IUnknown)
  671.     [SID_IShellPropSheetExt]
  672.     function AddPages(lpfnAddPage: TFNAddPropSheetPage; lParam: LPARAM): HResult; stdcall;
  673.     function ReplacePage(uPageID: UINT; lpfnReplaceWith: TFNAddPropSheetPage;
  674.       lParam: LPARAM): HResult; stdcall;
  675.   end;
  676.  
  677. { IPersistFolder Interface }
  678. {  The IPersistFolder interface is used by the file system implementation of }
  679. { IShellFolder::BindToObject when it is initializing a shell folder object. }
  680.  
  681. { IPersistFolder::Initialize }
  682. {  This member function is called when the explorer is initializing a }
  683. { shell folder object. }
  684. {  Parameters: }
  685. {   pidl -- Specifies the absolute location of the folder. }
  686.  
  687.   {$EXTERNALSYM IPersistFolder}
  688.   IPersistFolder = interface(IPersist)
  689.     [SID_IPersistFolder]
  690.     function Initialize(pidl: PItemIDList): HResult; stdcall;
  691.   end;
  692.  
  693.   {$EXTERNALSYM IPersistFolder2}
  694.   IPersistFolder2 = interface(IPersistFolder)
  695.     [SID_IPersistFolder2]
  696.     function GetCurFolder(var pidl: PItemIDList): HResult; stdcall;
  697.   end;
  698.  
  699. { IExtractIcon interface }
  700.  
  701. { This interface is used in two different places in the shell.
  702.  
  703.   Case-1: Icons of sub-folders for the scope-pane of the explorer.
  704.  
  705.    It is used by the explorer to get the 'icon location' of
  706.   sub-folders from each shell folders. When the user expands a folder
  707.   in the scope pane of the explorer, the explorer does following:
  708.    (1) binds to the folder (gets IShellFolder),
  709.    (2) enumerates its sub-folders by calling its EnumObjects member,
  710.    (3) calls its GetUIObjectOf member to get IExtractIcon interface
  711.       for each sub-folders.
  712.    In this case, the explorer uses only IExtractIcon.GetIconLocation
  713.   member to get the location of the appropriate icon. An icon location
  714.   always consists of a file name (typically DLL or EXE) and either an icon
  715.   resource or an icon index.
  716.  
  717.  
  718.   Case-2: Extracting an icon image from a file
  719.  
  720.    It is used by the shell when it extracts an icon image
  721.   from a file. When the shell is extracting an icon from a file,
  722.   it does following:
  723.    (1) creates the icon extraction handler object (by getting its CLSID
  724.       under the beginProgIDend\shell\ExtractIconHanler key and calling
  725.       CoCreateInstance requesting for IExtractIcon interface).
  726.    (2) Calls IExtractIcon.GetIconLocation.
  727.    (3) Then, calls IExtractIcon.Extract with the location/index pair.
  728.    (4) If (3) returns NOERROR, it uses the returned icon.
  729.    (5) Otherwise, it recursively calls this logic with new location
  730.       assuming that the location string contains a fully qualified path name.
  731.  
  732.    From extension programmer's point of view, there are only two cases
  733.   where they provide implementations of IExtractIcon:
  734.    Case-1) providing explorer extensions (i.e., IShellFolder).
  735.    Case-2) providing per-instance icons for some types of files.
  736.  
  737.   Because Case-1 is described above, we'll explain only Case-2 here.
  738.  
  739.   When the shell is about display an icon for a file, it does following:
  740.    (1) Finds its ProgID and ClassID.
  741.    (2) If the file has a ClassID, it gets the icon location string from the
  742.      'DefaultIcon' key under it. The string indicates either per-class
  743.      icon (e.g., 'FOOBAR.DLL,2') or per-instance icon (e.g., '%1,1').
  744.    (3) If a per-instance icon is specified, the shell creates an icon
  745.      extraction handler object for it, and extracts the icon from it
  746.      (which is described above).
  747.  
  748.    It is important to note that the shell calls IExtractIcon.GetIconLocation
  749.   first, then calls IExtractIcon.Extract. Most application programs
  750.   that support per-instance icons will probably store an icon location
  751.   (DLL/EXE name and index/id) rather than an icon image in each file.
  752.   In those cases, a programmer needs to implement only the GetIconLocation
  753.   member and it Extract member simply returns S_FALSE. They need to
  754.   implement Extract member only if they decided to store the icon images
  755.   within files themselved or some other database (which is very rare). }
  756.  
  757. { [Member functions] }
  758.  
  759. { IExtractIcon.GetIconLocation }
  760.  
  761. { This function returns an icon location.
  762.  
  763.   Parameters:
  764.    uFlags     [in]  -- Specifies if it is opened or not (GIL_OPENICON or 0)
  765.    szIconFile [out] -- Specifies the string buffer buffer for a location name.
  766.    cchMax     [in]  -- Specifies the size of szIconFile (almost always MAX_PATH)
  767.    piIndex    [out] -- Sepcifies the address of UINT for the index.
  768.    pwFlags    [out] -- Returns GIL_* flags
  769.   Returns:
  770.    NOERROR, if it returns a valid location; S_FALSE, if the shell use a
  771.    default icon.
  772.  
  773.   Notes: The location may or may not be a path to a file. The caller can
  774.    not assume anything unless the subsequent Extract member call returns
  775.    S_FALSE.
  776.  
  777.    if the returned location is not a path to a file, GIL_NOTFILENAME should
  778.    be set in the returned flags. }
  779.  
  780. { IExtractIcon.Extract }
  781.  
  782. { This function extracts an icon image from a specified file.
  783.  
  784.   Parameters:
  785.    pszFile [in] -- Specifies the icon location (typically a path to a file).
  786.    nIconIndex [in] -- Specifies the icon index.
  787.    phiconLarge [out] -- Specifies the HICON variable for large icon.
  788.    phiconSmall [out] -- Specifies the HICON variable for small icon.
  789.    nIconSize [in] -- Specifies the size icon required (size of large icon)
  790.                      LOWORD is the requested large icon size
  791.                      HIWORD is the requested small icon size
  792.   Returns:
  793.    NOERROR, if it extracted the from the file.
  794.    S_FALSE, if the caller should extract from the file specified in the
  795.            location. }
  796.  
  797. const
  798.   {$EXTERNALSYM GIL_OPENICON}
  799.   GIL_OPENICON         = $0001;      { allows containers to specify an "open" look }
  800.   {$EXTERNALSYM GIL_FORSHELL}
  801.   GIL_FORSHELL         = $0002;      { icon is to be displayed in a ShellFolder }
  802.   {$EXTERNALSYM GIL_ASYNC}
  803.   GIL_ASYNC            = $0020;      { this is an async extract, return E_ASYNC }
  804.  
  805. { GetIconLocation() return flags }
  806.  
  807.   {$EXTERNALSYM GIL_SIMULATEDOC}
  808.   GIL_SIMULATEDOC      = $0001;      { simulate this document icon for this }
  809.   {$EXTERNALSYM GIL_PERINSTANCE}
  810.   GIL_PERINSTANCE      = $0002;      { icons from this class are per instance (each file has its own) }
  811.   {$EXTERNALSYM GIL_PERCLASS}
  812.   GIL_PERCLASS         = $0004;      { icons from this class per class (shared for all files of this type) }
  813.   {$EXTERNALSYM GIL_NOTFILENAME}
  814.   GIL_NOTFILENAME      = $0008;      { location is not a filename, must call ::ExtractIcon }
  815.   {$EXTERNALSYM GIL_DONTCACHE}
  816.   GIL_DONTCACHE        = $0010;      { this icon should not be cached }
  817.  
  818. type
  819.   {$EXTERNALSYM IExtractIconA}
  820.   IExtractIconA = interface(IUnknown)
  821.     [SID_IExtractIconA]
  822.     function GetIconLocation(uFlags: UINT; szIconFile: PAnsiChar; cchMax: UINT;
  823.       out piIndex: Integer; out pwFlags: UINT): HResult; stdcall;
  824.     function Extract(pszFile: PAnsiChar; nIconIndex: UINT;
  825.       out phiconLarge, phiconSmall: HICON; nIconSize: UINT): HResult; stdcall;
  826.   end;
  827.   {$EXTERNALSYM IExtractIconW}
  828.   IExtractIconW = interface(IUnknown)
  829.     [SID_IExtractIconW]
  830.     function GetIconLocation(uFlags: UINT; szIconFile: PWideChar; cchMax: UINT;
  831.       out piIndex: Integer; out pwFlags: UINT): HResult; stdcall;
  832.     function Extract(pszFile: PWideChar; nIconIndex: UINT;
  833.       out phiconLarge, phiconSmall: HICON; nIconSize: UINT): HResult; stdcall;
  834.   end;
  835.   {$EXTERNALSYM IExtractIcon}
  836.   IExtractIcon = IExtractIconA;
  837.  
  838.  
  839. { IShellIcon Interface }
  840. { Used to get a icon index for a IShellFolder object.
  841.  
  842.  This interface can be implemented by a IShellFolder, as a quick way to
  843.  return the icon for a object in the folder.
  844.  
  845.  An instance of this interface is only created once for the folder, unlike
  846.  IExtractIcon witch is created once for each object.
  847.  
  848.  If a ShellFolder does not implement this interface, the standard
  849.  GetUIObject(....IExtractIcon) method will be used to get a icon
  850.  for all objects.
  851.  
  852.  The following standard imagelist indexs can be returned:
  853.  
  854.       0   document (blank page) (not associated)
  855.       1   document (with stuff on the page)
  856.       2   application (exe, com, bat)
  857.       3   folder (plain)
  858.       4   folder (open)
  859.  
  860.  IShellIcon.GetIconOf(pidl, flags, lpIconIndex)
  861.  
  862.       pidl            object to get icon for.
  863.       flags           GIL_* input flags (GIL_OPEN, ...)
  864.       lpIconIndex     place to return icon index.
  865.  
  866.   returns:
  867.       NOERROR, if lpIconIndex contains the correct system imagelist index.
  868.       S_FALSE, if unable to get icon for this object, go through
  869.                GetUIObject, IExtractIcon, methods. }
  870.  
  871.   {$EXTERNALSYM IShellIcon}
  872.   IShellIcon = interface(IUnknown)
  873.     [SID_IShellIcon]
  874.     function GetIconOf(pidl: PItemIDList; flags: UINT;
  875.       out IconIndex: Integer): HResult; stdcall;
  876.   end;
  877.  
  878. { IShellIconOverlayIdentifier }
  879. {
  880.  Used to identify a file as a member of the group of files that have this specific
  881.  icon overlay
  882.  
  883.  Users can create new IconOverlayIdentifiers and place them in the following registry
  884.  location together with the Icon overlay image and their priority.
  885.  HKEY_LOCAL_MACHINE "Software\\Microsoft\\Windows\\CurrentVersion\\ShellIconOverlayIdentifiers"
  886.  
  887.  The shell will enumerate through all IconOverlayIdentifiers at start, and prioritize
  888.  them according to internal rules, in case the internal rules don't apply, we use their
  889.  input priority
  890.  
  891.  IShellIconOverlayIdentifier:IsMemberOf(LPCWSTR pwszPath, DWORD dwAttrib)
  892.       pwszPath        full path of the file
  893.       dwAttrib        attribute of this file
  894.  
  895.   returns:
  896.       S_OK,    if the file is a member
  897.       S_FALSE, if the file is not a member
  898.       E_FAIL,  if the operation failed due to bad WIN32_FIND_DATA
  899.  
  900.  IShellIconOverlayIdentifier::GetOverlayInfo(LPWSTR pwszIconFile, int * pIndex, DWORD * dwFlags) PURE;
  901.       pszIconFile    the path of the icon file
  902.       pIndex         Depend on the flags, this could contain the IconIndex or the Sytem Imagelist Index
  903.       dwFlags        defined below
  904.  
  905.  IShellIconOverlayIdentifier::GetPriority(int * pIPriority) PURE;
  906.       pIPriority     the priority of this Overlay Identifier
  907. }
  908.  
  909.   {$EXTERNALSYM IShellIconOverlayIdentifier}
  910.   IShellIconOverlayIdentifier = interface(IUnknown)
  911.     [SID_IShellIconOverlayIdentifier]
  912.     function IsMemberOf(pwszPath: PWideChar; dwAttrib: DWORD): HResult; stdcall;
  913.     function GetOverlayInfo(pwszIconFile: PWideChar; cchMax: Integer;
  914.       var pIndex: Integer; var pdwFlags: DWORD): HResult; stdcall;
  915.     function GetPriority(out pIPriority: Integer): HResult; stdcall;
  916.   end;
  917.  
  918. const
  919.   {$EXTERNALSYM ISIOI_ICONFILE}
  920.   ISIOI_ICONFILE            = $00000001;  // path is returned through pwszIconFile
  921.   {$EXTERNALSYM ISIOI_ICONINDEX}
  922.   ISIOI_ICONINDEX           = $00000002;  // icon index in pwszIconFile is returned through pIndex
  923.   {$EXTERNALSYM ISIOI_SYSIMAGELISTINDEX}
  924.   ISIOI_SYSIMAGELISTINDEX   = $00000004;  // system imagelist icon index is returned through pIndex
  925.  
  926. { IShellIconOverlay }
  927. {
  928.  Used to return the icon overlay index or its icon index for an IShellFolder object,
  929.  this is always implemented with IShellFolder
  930.  
  931.  IShellIconOverlay:GetOverlayIndex(LPCITEMIDLIST pidl, DWORD * pdwIndex)
  932.       pidl            object to identify icon overlay for.
  933.       pdwIndex        the Overlay Index in the system image list
  934.  
  935.  IShellIconOverlay:GetOverlayIconIndex(LPCITEMIDLIST pidl, DWORD * pdwIndex)
  936.       pdwIconIndex    the Overlay Icon index in the system image list
  937.  This method is only used for those who are interested in seeing the real bits
  938.  of the Overlay Icon
  939.  
  940.   returns:
  941.       S_OK,  if the index of an Overlay is found
  942.       S_FALSE, if no Overlay exists for this file
  943.       E_FAIL, if pidl is bad
  944. }
  945. type
  946.   {$EXTERNALSYM IShellIconOverlay}
  947.   IShellIconOverlay = interface(IUnknown)
  948.     [SID_IShellIconOverlay]
  949.     function GetOverlayIndex(pidl: PItemIDList; out pIndex: Integer): HResult; stdcall;
  950.     function GetOverlayIconIndex(pidl: PItemIDList; out pIconIndex: Integer): HResult; stdcall;
  951.   end;
  952.  
  953. { IShellLink Interface }
  954. const
  955.   { IShellLink.Resolve fFlags }
  956.   {$EXTERNALSYM SLR_NO_UI}
  957.   SLR_NO_UI           = $0001;
  958.   {$EXTERNALSYM SLR_ANY_MATCH}
  959.   SLR_ANY_MATCH       = $0002;
  960.   {$EXTERNALSYM SLR_UPDATE}
  961.   SLR_UPDATE          = $0004;
  962.   {$EXTERNALSYM SLR_NOUPDATE}
  963.   SLR_NOUPDATE        = $0008;
  964.  
  965.   { IShellLink.GetPath fFlags }
  966.   {$EXTERNALSYM SLGP_SHORTPATH}
  967.   SLGP_SHORTPATH      = $0001;
  968.   {$EXTERNALSYM SLGP_UNCPRIORITY}
  969.   SLGP_UNCPRIORITY    = $0002;
  970.   {$EXTERNALSYM SLGP_RAWPATH}
  971.   SLGP_RAWPATH        = $0004;
  972.  
  973. type
  974.   {$EXTERNALSYM IShellLinkA}
  975.   IShellLinkA = interface(IUnknown) { sl }
  976.     [SID_IShellLinkA]
  977.     function GetPath(pszFile: PAnsiChar; cchMaxPath: Integer;
  978.       var pfd: TWin32FindData; fFlags: DWORD): HResult; stdcall;
  979.     function GetIDList(var ppidl: PItemIDList): HResult; stdcall;
  980.     function SetIDList(pidl: PItemIDList): HResult; stdcall;
  981.     function GetDescription(pszName: PAnsiChar; cchMaxName: Integer): HResult; stdcall;
  982.     function SetDescription(pszName: PAnsiChar): HResult; stdcall;
  983.     function GetWorkingDirectory(pszDir: PAnsiChar; cchMaxPath: Integer): HResult; stdcall;
  984.     function SetWorkingDirectory(pszDir: PAnsiChar): HResult; stdcall;
  985.     function GetArguments(pszArgs: PAnsiChar; cchMaxPath: Integer): HResult; stdcall;
  986.     function SetArguments(pszArgs: PAnsiChar): HResult; stdcall;
  987.     function GetHotkey(var pwHotkey: Word): HResult; stdcall;
  988.     function SetHotkey(wHotkey: Word): HResult; stdcall;
  989.     function GetShowCmd(out piShowCmd: Integer): HResult; stdcall;
  990.     function SetShowCmd(iShowCmd: Integer): HResult; stdcall;
  991.     function GetIconLocation(pszIconPath: PAnsiChar; cchIconPath: Integer;
  992.       out piIcon: Integer): HResult; stdcall;
  993.     function SetIconLocation(pszIconPath: PAnsiChar; iIcon: Integer): HResult; stdcall;
  994.     function SetRelativePath(pszPathRel: PAnsiChar; dwReserved: DWORD): HResult; stdcall;
  995.     function Resolve(Wnd: HWND; fFlags: DWORD): HResult; stdcall;
  996.     function SetPath(pszFile: PAnsiChar): HResult; stdcall;
  997.   end;
  998.   {$EXTERNALSYM IShellLinkW}
  999.   IShellLinkW = interface(IUnknown) { sl }
  1000.     [SID_IShellLinkW]
  1001.     function GetPath(pszFile: PWideChar; cchMaxPath: Integer;
  1002.       var pfd: TWin32FindData; fFlags: DWORD): HResult; stdcall;
  1003.     function GetIDList(var ppidl: PItemIDList): HResult; stdcall;
  1004.     function SetIDList(pidl: PItemIDList): HResult; stdcall;
  1005.     function GetDescription(pszName: PWideChar; cchMaxName: Integer): HResult; stdcall;
  1006.     function SetDescription(pszName: PWideChar): HResult; stdcall;
  1007.     function GetWorkingDirectory(pszDir: PWideChar; cchMaxPath: Integer): HResult; stdcall;
  1008.     function SetWorkingDirectory(pszDir: PWideChar): HResult; stdcall;
  1009.     function GetArguments(pszArgs: PWideChar; cchMaxPath: Integer): HResult; stdcall;
  1010.     function SetArguments(pszArgs: PWideChar): HResult; stdcall;
  1011.     function GetHotkey(var pwHotkey: Word): HResult; stdcall;
  1012.     function SetHotkey(wHotkey: Word): HResult; stdcall;
  1013.     function GetShowCmd(out piShowCmd: Integer): HResult; stdcall;
  1014.     function SetShowCmd(iShowCmd: Integer): HResult; stdcall;
  1015.     function GetIconLocation(pszIconPath: PWideChar; cchIconPath: Integer;
  1016.       out piIcon: Integer): HResult; stdcall;
  1017.     function SetIconLocation(pszIconPath: PWideChar; iIcon: Integer): HResult; stdcall;
  1018.     function SetRelativePath(pszPathRel: PWideChar; dwReserved: DWORD): HResult; stdcall;
  1019.     function Resolve(Wnd: HWND; fFlags: DWORD): HResult; stdcall;
  1020.     function SetPath(pszFile: PWideChar): HResult; stdcall;
  1021.   end;
  1022.   {$EXTERNALSYM IShellLink}
  1023.   IShellLink = IShellLinkA;
  1024.  
  1025. { IShellExecuteHook Interface }
  1026.  
  1027.   {$EXTERNALSYM IShellExecuteHookA}
  1028.   IShellExecuteHookA = interface(IUnknown) { sl }
  1029.     [SID_IShellExecuteHookA]
  1030.     function Execute(var ShellExecuteInfo: TShellExecuteInfo): HResult; stdcall;
  1031.   end;
  1032.   {$EXTERNALSYM IShellExecuteHookW}
  1033.   IShellExecuteHookW = interface(IUnknown) { sl }
  1034.     [SID_IShellExecuteHookW]
  1035.     function Execute(var ShellExecuteInfo: TShellExecuteInfo): HResult; stdcall;
  1036.   end;
  1037.   {$EXTERNALSYM IShellExecuteHook}
  1038.   IShellExecuteHook = IShellExecuteHookA;
  1039.  
  1040. { IURLSearchHook Interface }
  1041.  
  1042.   {$EXTERNALSYM IURLSearchHook}
  1043.   IURLSearchHook = interface(IUnknown)
  1044.     [SID_IURLSearchHook]
  1045.     function Translate(lpwszSearchURL: PWideChar; cchBufferSize: DWORD): HResult; stdcall;
  1046.   end;
  1047.  
  1048. { INewShortcutHook Interface }
  1049.  
  1050.   {$EXTERNALSYM INewShortcutHookA}
  1051.   INewShortcutHookA = interface(IUnknown) { sl }
  1052.     [SID_INewShortcutHookA]
  1053.     function SetReferent(pcszReferent: PAnsiChar; Wnd: HWND): HResult; stdcall;
  1054.     function GetReferent(pcszReferent: PAnsiChar; cchReferent: Integer): HResult; stdcall;
  1055.     function SetFolder(pcszFolder: PAnsiChar; Wnd: HWND): HResult; stdcall;
  1056.     function GetFolder(pcszFolder: PAnsiChar; cchFolder: Integer): HResult; stdcall;
  1057.     function GetName(pcszName: PAnsiChar; cchName: Integer): HResult; stdcall;
  1058.     function GetExtension(pcszExtension: PAnsiChar; cchExtension: Integer): HResult; stdcall;
  1059.   end;
  1060.   {$EXTERNALSYM INewShortcutHookW}
  1061.   INewShortcutHookW = interface(IUnknown) { sl }
  1062.     [SID_INewShortcutHookW]
  1063.     function SetReferent(pcszReferent: PWideChar; Wnd: HWND): HResult; stdcall;
  1064.     function GetReferent(pcszReferent: PWideChar; cchReferent: Integer): HResult; stdcall;
  1065.     function SetFolder(pcszFolder: PWideChar; Wnd: HWND): HResult; stdcall;
  1066.     function GetFolder(pcszFolder: PWideChar; cchFolder: Integer): HResult; stdcall;
  1067.     function GetName(pcszName: PWideChar; cchName: Integer): HResult; stdcall;
  1068.     function GetExtension(pcszExtension: PWideChar; cchExtension: Integer): HResult; stdcall;
  1069.   end;
  1070.   {$EXTERNALSYM INewShortcutHook}
  1071.   INewShortcutHook = INewShortcutHookA;
  1072.  
  1073. { ICopyHook Interface }
  1074.  
  1075. { The copy hook is called whenever file system directories are
  1076.   copy/moved/deleted/renamed via the shell.  It is also called by the shell
  1077.   on changes of status of printers.
  1078.   Clients register their id under STRREG_SHEX_COPYHOOK for file system hooks
  1079.   and STRREG_SHEx_PRNCOPYHOOK for printer hooks.
  1080.   the CopyCallback is called prior to the action, so the hook has the chance
  1081.   to allow, deny or cancel the operation by returning the falues:
  1082.      IDYES  -  means allow the operation
  1083.      IDNO   -  means disallow the operation on this file, but continue with
  1084.               any other operations (eg. batch copy)
  1085.      IDCANCEL - means disallow the current operation and cancel any pending
  1086.               operations
  1087.    arguments to the CopyCallback
  1088.       hwnd - window to use for any UI
  1089.       wFunc - what operation is being done
  1090.       wFlags - and flags (FOF_*) set in the initial call to the file operation
  1091.       pszSrcFile - name of the source file
  1092.       dwSrcAttribs - file attributes of the source file
  1093.       pszDestFile - name of the destiation file (for move and renames)
  1094.       dwDestAttribs - file attributes of the destination file }
  1095.  
  1096. type
  1097.   {$EXTERNALSYM ICopyHookA}
  1098.   ICopyHookA = interface(IUnknown) { sl }
  1099.     [SID_IShellCopyHookA]
  1100.     function CopyCallback(Wnd: HWND; wFunc, wFlags: UINT; pszSrcFile: PAnsiChar;
  1101.       dwSrcAttribs: DWORD; pszDestFile: PAnsiChar; dwDestAttribs: DWORD): UINT; stdcall;
  1102.   end;
  1103.   {$EXTERNALSYM ICopyHookW}
  1104.   ICopyHookW = interface(IUnknown) { sl }
  1105.     [SID_IShellCopyHookW]
  1106.     function CopyCallback(Wnd: HWND; wFunc, wFlags: UINT; pszSrcFile: PWideChar;
  1107.       dwSrcAttribs: DWORD; pszDestFile: PWideChar; dwDestAttribs: DWORD): UINT; stdcall;
  1108.   end;
  1109.   {$EXTERNALSYM ICopyHook}
  1110.   ICopyHook = ICopyHookA;
  1111.  
  1112. { IFileViewerSite Interface }
  1113.  
  1114. type
  1115.   {$EXTERNALSYM IFileViewerSite}
  1116.   IFileViewerSite = interface(IUnknown)
  1117.     [SID_IFileViewerSite]
  1118.     function SetPinnedWindow(Wnd: HWND): HResult; stdcall;
  1119.     function GetPinnedWindow(var Wnd: HWND): HResult; stdcall;
  1120.   end;
  1121.  
  1122. { IFileViewer Interface }
  1123.  
  1124. { Implemented in a FileViewer component object.  Used to tell a
  1125.   FileViewer to PrintTo or to view, the latter happening though
  1126.   ShowInitialize and Show.  The filename is always given to the
  1127.   viewer through IPersistFile. }
  1128.  
  1129. type
  1130.   // !!! unnamed struct
  1131.   PFVShowInfo = ^FVSHOWINFO;
  1132.   FVSHOWINFO = packed record
  1133.     { Stuff passed into viewer (in) }
  1134.     cbSize: DWORD;           { Size of structure for future expansion... }
  1135.     hwndOwner: HWND;         { who is the owner window. }
  1136.     iShow: Integer;          { The show command }
  1137.  
  1138.     { Passed in and updated  (in/Out) }
  1139.     dwFlags: DWORD;          { flags }
  1140.     rect: TRECT;             { Where to create the window may have defaults }
  1141.     punkRel: IUNKNOWN;       { Relese this interface when window is visible }
  1142.  
  1143.     { Stuff that might be returned from viewer (out) }
  1144.     strNewFile: array[0..MAX_PATH-1] of TOleChar;   { New File to view. }
  1145.   end;
  1146.   {$EXTERNALSYM FVSHOWINFO}
  1147.   TFVShowInfo = FVSHOWINFO;
  1148.   LPFVSHOWINFO = PFVShowInfo;
  1149.   {$EXTERNALSYM LPFVSHOWINFO}
  1150.   
  1151. const
  1152. { Define File View Show Info Flags. }
  1153.  
  1154.   {$EXTERNALSYM FVSIF_RECT}
  1155.   FVSIF_RECT      = $00000001;      { The rect variable has valid data. }
  1156.   {$EXTERNALSYM FVSIF_PINNED}
  1157.   FVSIF_PINNED    = $00000002;      { We should Initialize pinned }
  1158.  
  1159.   {$EXTERNALSYM FVSIF_NEWFAILED}
  1160.   FVSIF_NEWFAILED = $08000000;      { The new file passed back failed
  1161.                                        to be viewed. }
  1162.  
  1163.   {$EXTERNALSYM FVSIF_NEWFILE}
  1164.   FVSIF_NEWFILE   = $80000000;      { A new file to view has been returned }
  1165.   {$EXTERNALSYM FVSIF_CANVIEWIT}
  1166.   FVSIF_CANVIEWIT = $40000000;      { The viewer can view it. }
  1167.  
  1168. type
  1169.   {$EXTERNALSYM IFileViewerA}
  1170.   IFileViewerA = interface(IUnknown)
  1171.     [SID_IFileViewerA]
  1172.     function ShowInitialize(fsi: IFileViewerSite): HResult; stdcall;
  1173.     function Show(var pvsi: TFVShowInfo): HResult; stdcall;
  1174.     function PrintTo(pszDriver: PAnsiChar; fSuppressUI: BOOL): HResult; stdcall;
  1175.   end;
  1176.   {$EXTERNALSYM IFileViewerW}
  1177.   IFileViewerW = interface(IUnknown)
  1178.     [SID_IFileViewerW]
  1179.     function ShowInitialize(fsi: IFileViewerSite): HResult; stdcall;
  1180.     function Show(var pvsi: TFVShowInfo): HResult; stdcall;
  1181.     function PrintTo(pszDriver: PWideChar; fSuppressUI: BOOL): HResult; stdcall;
  1182.   end;
  1183.   {$EXTERNALSYM IFileViewer}
  1184.   IFileViewer = IFileViewerA;
  1185.  
  1186. { CommandTarget ids. for shell doc view wedge }
  1187.  
  1188.   {$EXTERNALSYM TSHDVIDEnums}
  1189.   TSHDVIDEnums = (
  1190.     SHDVID_SETPROGRESSPOS,
  1191.     SHDVID_SETPROGRESSRANGE,
  1192.     SHDVID_SETSTATUSTEXT,        { variantIn  bstr }
  1193.     SHDVID_REFRESH,
  1194.     SHDVID_STOP,
  1195.     SHDVID_UPDATECOMMANDS, { / this forces a re-querystatus of the command targets. }
  1196.                            { / the arg in can specify a specific one to update or NIL for evrything }
  1197.     SHDVID_SETTITLE,            { variantIn bstr }
  1198.     SHDVID_FINALTITLEAVAIL,     { variantIn bstr - sent after final SETTITLE is sent }
  1199.     SHDVID_STARTLOAD,           { NIL for everything }
  1200.     SHDVID_STOPLOAD,            { NIL for everything }
  1201.     SHDVID_CCALLBACK,           { callback to arbitrary C func }
  1202.     SHDVID_MENUEXEC,            { do menu command }
  1203.     SHDVID_MENUQS               { query menu commands }
  1204.   );
  1205.  
  1206. { IShellBrowser/IShellView/IShellFolder interface }
  1207.  
  1208. {  These three interfaces are used when the shell communicates with }
  1209. { name space extensions. The shell (explorer) provides IShellBrowser }
  1210. { interface, and extensions implements IShellFolder and IShellView }
  1211. { interfaces. }
  1212.  
  1213. { ========================================================================== }
  1214.  
  1215.  
  1216. { -------------------------------------------------------------------------- }
  1217.  
  1218. { Command/menuitem IDs }
  1219.  
  1220. {  The explorer dispatches WM_COMMAND messages based on the range of }
  1221. { command/menuitem IDs. All the IDs of menuitems that the view (right }
  1222. { pane) inserts must be in FCIDM_SHVIEWFIRST/LAST (otherwise, the explorer }
  1223. { won't dispatch them). The view should not deal with any menuitems }
  1224. { in FCIDM_BROWSERFIRST/LAST (otherwise, it won't work with the future }
  1225. { version of the shell). }
  1226.  
  1227. {  FCIDM_SHVIEWFIRST/LAST      for the right pane (IShellView) }
  1228. {  FCIDM_BROWSERFIRST/LAST     for the explorer frame (IShellBrowser) }
  1229. {  FCIDM_GLOBAL/LAST           for the explorer's submenu IDs }
  1230.  
  1231. const
  1232.   {$EXTERNALSYM FCIDM_SHVIEWFIRST}
  1233.   FCIDM_SHVIEWFIRST               = $0000;
  1234.   {$EXTERNALSYM FCIDM_SHVIEWLAST}
  1235.   FCIDM_SHVIEWLAST                = $7fff;
  1236.   {$EXTERNALSYM FCIDM_BROWSERFIRST}
  1237.   FCIDM_BROWSERFIRST              = $a000;
  1238.   {$EXTERNALSYM FCIDM_BROWSERLAST}
  1239.   FCIDM_BROWSERLAST               = $bf00;
  1240.   {$EXTERNALSYM FCIDM_GLOBALFIRST}
  1241.   FCIDM_GLOBALFIRST               = $8000;
  1242.   {$EXTERNALSYM FCIDM_GLOBALLAST}
  1243.   FCIDM_GLOBALLAST                = $9fff;
  1244.  
  1245.  
  1246. { Global submenu IDs and separator IDs }
  1247.  
  1248.   {$EXTERNALSYM FCIDM_MENU_FILE}
  1249.   FCIDM_MENU_FILE                 = FCIDM_GLOBALFIRST+$0000;
  1250.   {$EXTERNALSYM FCIDM_MENU_EDIT}
  1251.   FCIDM_MENU_EDIT                 = FCIDM_GLOBALFIRST+$0040;
  1252.   {$EXTERNALSYM FCIDM_MENU_VIEW}
  1253.   FCIDM_MENU_VIEW                 = FCIDM_GLOBALFIRST+$0080;
  1254.   {$EXTERNALSYM FCIDM_MENU_VIEW_SEP_OPTIONS}
  1255.   FCIDM_MENU_VIEW_SEP_OPTIONS     = FCIDM_GLOBALFIRST+$0081;
  1256.   {$EXTERNALSYM FCIDM_MENU_TOOLS}
  1257.   FCIDM_MENU_TOOLS                = FCIDM_GLOBALFIRST+$00c0;
  1258.   {$EXTERNALSYM FCIDM_MENU_TOOLS_SEP_GOTO}
  1259.   FCIDM_MENU_TOOLS_SEP_GOTO       = FCIDM_GLOBALFIRST+$00c1;
  1260.   {$EXTERNALSYM FCIDM_MENU_HELP}
  1261.   FCIDM_MENU_HELP                 = FCIDM_GLOBALFIRST+$0100;
  1262.   {$EXTERNALSYM FCIDM_MENU_FIND}
  1263.   FCIDM_MENU_FIND                 = FCIDM_GLOBALFIRST+$0140;
  1264.   {$EXTERNALSYM FCIDM_MENU_EXPLORE}
  1265.   FCIDM_MENU_EXPLORE              = FCIDM_GLOBALFIRST+$0150;
  1266.   {$EXTERNALSYM FCIDM_MENU_FAVORITES}
  1267.   FCIDM_MENU_FAVORITES            = FCIDM_GLOBALFIRST+$0170;
  1268.  
  1269. { -------------------------------------------------------------------------- }
  1270. { control IDs known to the view }
  1271. { -------------------------------------------------------------------------- }
  1272.  
  1273.   {$EXTERNALSYM FCIDM_TOOLBAR}
  1274.   FCIDM_TOOLBAR          = FCIDM_BROWSERFIRST + 0;
  1275.   {$EXTERNALSYM FCIDM_STATUS}
  1276.   FCIDM_STATUS           = FCIDM_BROWSERFIRST + 1;
  1277.  
  1278.   { The resource id of the offline cursor }
  1279.   { This cursor is avaialble in shdocvw.dll }
  1280.   {$EXTERNALSYM IDC_OFFLINE_HAND}
  1281.   IDC_OFFLINE_HAND       = 103;
  1282.  
  1283. { -------------------------------------------------------------------------- }
  1284.  
  1285. { FOLDERSETTINGS }
  1286.  
  1287. {  FOLDERSETTINGS is a data structure that explorer passes from one folder }
  1288. { view to another, when the user is browsing. It calls ISV::GetCurrentInfo }
  1289. { member to get the current settings and pass it to ISV::CreateViewWindow }
  1290. { to allow the next folder view "inherit" it. These settings assumes a }
  1291. { particular UI (which the shell's folder view has), and shell extensions }
  1292. { may or may not use those settings. }
  1293.  
  1294. { -------------------------------------------------------------------------- }
  1295.  
  1296. { NB Bitfields. }
  1297. { FWF_DESKTOP implies FWF_TRANSPARENT/NOCLIENTEDGE/NOSCROLL }
  1298. const
  1299.   {$EXTERNALSYM FWF_AUTOARRANGE}
  1300.   FWF_AUTOARRANGE = $0001;
  1301.   {$EXTERNALSYM FWF_ABBREVIATEDNAMES}
  1302.   FWF_ABBREVIATEDNAMES = $0002;
  1303.   {$EXTERNALSYM FWF_SNAPTOGRID}
  1304.   FWF_SNAPTOGRID = $0004;
  1305.   {$EXTERNALSYM FWF_OWNERDATA}
  1306.   FWF_OWNERDATA = $0008;
  1307.   {$EXTERNALSYM FWF_BESTFITWINDOW}
  1308.   FWF_BESTFITWINDOW = $0010;
  1309.   {$EXTERNALSYM FWF_DESKTOP}
  1310.   FWF_DESKTOP = $0020;
  1311.   {$EXTERNALSYM FWF_SINGLESEL}
  1312.   FWF_SINGLESEL = $0040;
  1313.   {$EXTERNALSYM FWF_NOSUBFOLDERS}
  1314.   FWF_NOSUBFOLDERS = $0080;
  1315.   {$EXTERNALSYM FWF_TRANSPARENT}
  1316.   FWF_TRANSPARENT = $0100;
  1317.   {$EXTERNALSYM FWF_NOCLIENTEDGE}
  1318.   FWF_NOCLIENTEDGE = $0200;
  1319.   {$EXTERNALSYM FWF_NOSCROLL}
  1320.   FWF_NOSCROLL    = $0400;
  1321.   {$EXTERNALSYM FWF_ALIGNLEFT}
  1322.   FWF_ALIGNLEFT   = $0800;
  1323.   {$EXTERNALSYM FWF_NOICONS}
  1324.   FWF_NOICONS     = $1000;
  1325.   {$EXTERNALSYM FWF_SINGLECLICKACTIVATE}
  1326.   FWF_SINGLECLICKACTIVATE = $8000; { TEMPORARY -- NO UI FOR THIS }
  1327.  
  1328.   {$EXTERNALSYM FVM_ICON}
  1329.   FVM_ICON = 1;
  1330.   {$EXTERNALSYM FVM_SMALLICON}
  1331.   FVM_SMALLICON = 2;
  1332.   {$EXTERNALSYM FVM_LIST}
  1333.   FVM_LIST = 3;
  1334.   {$EXTERNALSYM FVM_DETAILS}
  1335.   FVM_DETAILS = 4;
  1336.  
  1337. type
  1338.   // !!! unnamed struct
  1339.   PFolderSettings = ^FOLDERSETTINGS;
  1340.   FOLDERSETTINGS = packed record
  1341.     ViewMode: UINT;      { View mode (FOLDERVIEWMODE values) }
  1342.     fFlags: UINT;        { View options (FOLDERFLAGS bits) }
  1343.   end;
  1344.   {$EXTERNALSYM FOLDERSETTINGS}
  1345.   TFolderSettings = FOLDERSETTINGS;
  1346.   LPFOLDERSETTINGS = PFolderSettings;
  1347.   {$EXTERNALSYM LPFOLDERSETTINGS} 
  1348.  
  1349. { -------------------------------------------------------------------------- }
  1350.  
  1351. { Interface:   IShellBrowser }
  1352.  
  1353. {  IShellBrowser interface is the interface that is provided by the shell }
  1354. { explorer/folder frame window. When it creates the "contents pane" of }
  1355. { a shell folder (which provides IShellFolder interface), it calls its }
  1356. { CreateViewObject member function to create an IShellView object. Then, }
  1357. { it calls its CreateViewWindow member to create the "contents pane" }
  1358. { window. The pointer to the IShellBrowser interface is passed to }
  1359. { the IShellView object as a parameter to this CreateViewWindow member }
  1360. { function call. }
  1361.  
  1362. {    +--------------------------+  <-- Explorer window }
  1363. {    | [] Explorer              | }
  1364. {    |--------------------------+       IShellBrowser }
  1365. {    | File Edit View ..        | }
  1366. {    |--------------------------| }
  1367. {    |        |                 | }
  1368. {    |        |              <-------- Content pane }
  1369. {    |        |                 | }
  1370. {    |        |                 |       IShellView }
  1371. {    |        |                 | }
  1372. {    |        |                 | }
  1373. {    +--------------------------+ }
  1374.  
  1375.  
  1376.  
  1377. { [Member functions] }
  1378.  
  1379.  
  1380. { IShellBrowser.GetWindow(phwnd) }
  1381.  
  1382. {   Inherited from IOleWindow.GetWindow. }
  1383.  
  1384.  
  1385. { IShellBrowser.ContextSensitiveHelp(fEnterMode) }
  1386.  
  1387. {   Inherited from IOleWindow.ContextSensitiveHelp. }
  1388.  
  1389.  
  1390. { IShellBrowser.InsertMenusSB(hmenuShared, lpMenuWidths) }
  1391.  
  1392. {   Similar to the IOleInPlaceFrame.InsertMenus. The explorer will put }
  1393. {  "File" and "Edit" pulldown in the File menu group, "View" and "Tools" }
  1394. {  in the Container menu group and "Help" in the Window menu group. Each }
  1395. {  pulldown menu will have a uniqu ID, FCIDM_MENU_FILE/EDIT/VIEW/TOOLS/HELP. }
  1396. {  The view is allowed to insert menuitems into those sub-menus by those }
  1397. {  IDs must be between FCIDM_SHVIEWFIRST and FCIDM_SHVIEWLAST. }
  1398.  
  1399.  
  1400. { IShellBrowser.SetMenuSB(hmenuShared, holemenu, hwndActiveObject) }
  1401.  
  1402. {   Similar to the IOleInPlaceFrame.SetMenu. The explorer ignores the }
  1403. {  holemenu parameter (reserved for future enhancement)  and performs }
  1404. {  menu-dispatch based on the menuitem IDs (see the description above). }
  1405. {  It is important to note that the explorer will add different }
  1406. {  set of menuitems depending on whether the view has a focus or not. }
  1407. {  Therefore, it is very important to call ISB.OnViewWindowActivate }
  1408. {  whenever the view window (or its children) gets the focus. }
  1409.  
  1410.  
  1411. { IShellBrowser.RemoveMenusSB(hmenuShared) }
  1412.  
  1413. {   Same as the IOleInPlaceFrame.RemoveMenus. }
  1414.  
  1415.  
  1416. { IShellBrowser.SetStatusTextSB(lpszStatusText) }
  1417.  
  1418. {   Same as the IOleInPlaceFrame.SetStatusText. It is also possible to }
  1419. {  send messages directly to the status window via SendControlMsg. }
  1420.  
  1421.  
  1422. { IShellBrowser.EnableModelessSB(fEnable) }
  1423.  
  1424. {   Same as the IOleInPlaceFrame.EnableModeless. }
  1425.  
  1426. { IShellBrowser.TranslateAcceleratorSB(lpmsg, wID) }
  1427.  
  1428. {   Same as the IOleInPlaceFrame.TranslateAccelerator, but will be }
  1429. {  never called because we don't support EXEs (i.e., the explorer has }
  1430. {  the message loop). This member function is defined here for possible }
  1431. {  future enhancement. }
  1432.  
  1433.  
  1434. { IShellBrowser.BrowseObject(pidl, wFlags) }
  1435.  
  1436. {   The view calls this member to let shell explorer browse to another }
  1437. {  folder. The pidl and wFlags specifies the folder to be browsed. }
  1438.  
  1439. {  Following three flags specifies whether it creates another window or not. }
  1440. {   SBSP_SAMEBROWSER  -- Browse to another folder with the same window. }
  1441. {   SBSP_NEWBROWSER   -- Creates another window for the specified folder. }
  1442. {   SBSP_DEFBROWSER   -- Default behavior (respects the view option). }
  1443.  
  1444. {  Following three flags specifies open, explore, or default mode. These   . }
  1445. {  are ignored if SBSP_SAMEBROWSER or (SBSP_DEFBROWSER && (single window   . }
  1446. {  browser || explorer)).                                                  . }
  1447. {   SBSP_OPENMODE     -- Use a normal folder window }
  1448. {   SBSP_EXPLOREMODE  -- Use an explorer window }
  1449. {   SBSP_DEFMODE      -- Use the same as the current window }
  1450.  
  1451. {  Following three flags specifies the pidl. }
  1452. {   SBSP_ABSOLUTE -- pidl is an absolute pidl (relative from desktop) }
  1453. {   SBSP_RELATIVE -- pidl is relative from the current folder. }
  1454. {   SBSP_PARENT   -- Browse the parent folder (ignores the pidl) }
  1455. {   SBSP_NAVIGATEBACK    -- Navigate back (ignores the pidl) }
  1456. {   SBSP_NAVIGATEFORWARD -- Navigate forward (ignores the pidl) }
  1457.  
  1458. {  Following two flags control history manipulation as result of navigate }
  1459. {   SBSP_WRITENOHISTORY -- write no history (shell folder) entry }
  1460. {   SBSP_NOAUTOSELECT -- suppress selection in history pane }
  1461.  
  1462.  
  1463. { IShellBrowser.GetViewStateStream(grfMode, ppstm) }
  1464.  
  1465. {   The browser returns an IStream interface as the storage for view }
  1466. {  specific state information. }
  1467.  
  1468. {   grfMode -- Specifies the read/write access (STGM_READ/WRITE/READWRITE) }
  1469. {   ppstm   -- Specifies the LPSTREAM variable to be filled. }
  1470.  
  1471.  
  1472. { IShellBrowser.GetControlWindow(id, phwnd) }
  1473.  
  1474. {   The shell view may call this member function to get the window handle }
  1475. {  of Explorer controls (toolbar or status winodw -- FCW_TOOLBAR or }
  1476. {  FCW_STATUS). }
  1477.  
  1478.  
  1479. { IShellBrowser.SendControlMsg(id, uMsg, wParam, lParam, pret) }
  1480.  
  1481. {   The shell view calls this member function to send control messages to }
  1482. {  one of Explorer controls (toolbar or status window -- FCW_TOOLBAR or }
  1483. {  FCW_STATUS). }
  1484.  
  1485.  
  1486. { IShellBrowser.QueryActiveShellView(IShellView * ppshv) }
  1487.  
  1488. {   This member returns currently activated (displayed) shellview object. }
  1489. {  A shellview never need to call this member function. }
  1490.  
  1491.  
  1492. { IShellBrowser.OnViewWindowActive(pshv) }
  1493.  
  1494. {   The shell view window calls this member function when the view window }
  1495. {  (or one of its children) got the focus. It MUST call this member before }
  1496. {  calling IShellBrowser.InsertMenus, because it will insert different }
  1497. {  set of menu items depending on whether the view has the focus or not. }
  1498.  
  1499.  
  1500. { IShellBrowser.SetToolbarItems(lpButtons, nButtons, uFlags) }
  1501.  
  1502. {   The view calls this function to add toolbar items to the exporer's }
  1503. {  toolbar. "lpButtons" and "nButtons" specifies the array of toolbar }
  1504. {  items. "uFlags" must be one of FCT_MERGE, FCT_CONFIGABLE, FCT_ADDTOEND. }
  1505.  
  1506. { ------------------------------------------------------------------------- }
  1507.  
  1508.  
  1509. { Values for wFlags parameter of ISB.BrowseObject() member. }
  1510. const
  1511.   {$EXTERNALSYM SBSP_DEFBROWSER}
  1512.   SBSP_DEFBROWSER      = $0000;
  1513.   {$EXTERNALSYM SBSP_SAMEBROWSER}
  1514.   SBSP_SAMEBROWSER     = $0001;
  1515.   {$EXTERNALSYM SBSP_NEWBROWSER}
  1516.   SBSP_NEWBROWSER      = $0002;
  1517.  
  1518.   {$EXTERNALSYM SBSP_DEFMODE}
  1519.   SBSP_DEFMODE         = $0000;
  1520.   {$EXTERNALSYM SBSP_OPENMODE}
  1521.   SBSP_OPENMODE        = $0010;
  1522.   {$EXTERNALSYM SBSP_EXPLOREMODE}
  1523.   SBSP_EXPLOREMODE     = $0020;
  1524.  
  1525.   {$EXTERNALSYM SBSP_ABSOLUTE}
  1526.   SBSP_ABSOLUTE        = $0000;
  1527.   {$EXTERNALSYM SBSP_RELATIVE}
  1528.   SBSP_RELATIVE        = $1000;
  1529.   {$EXTERNALSYM SBSP_PARENT}
  1530.   SBSP_PARENT          = $2000;
  1531.   {$EXTERNALSYM SBSP_NAVIGATEBACK}
  1532.   SBSP_NAVIGATEBACK    = $4000;
  1533.   {$EXTERNALSYM SBSP_NAVIGATEFORWARD}
  1534.   SBSP_NAVIGATEFORWARD = $8000;
  1535.  
  1536.   {$EXTERNALSYM SBSP_ALLOW_AUTONAVIGATE}
  1537.   SBSP_ALLOW_AUTONAVIGATE = $10000;
  1538.  
  1539.   {$EXTERNALSYM SBSP_INITIATEDBYHLINKFRAME}
  1540.   SBSP_INITIATEDBYHLINKFRAME            = $80000000;
  1541.   {$EXTERNALSYM SBSP_REDIRECT}
  1542.   SBSP_REDIRECT                         = $40000000;
  1543.  
  1544.   {$EXTERNALSYM SBSP_WRITENOHISTORY}
  1545.   SBSP_WRITENOHISTORY     = $08000000;
  1546.   {$EXTERNALSYM SBSP_NOAUTOSELECT}
  1547.   SBSP_NOAUTOSELECT       = $04000000;
  1548.  
  1549. { Values for id parameter of ISB.GetWindow/SendControlMsg members. }
  1550.  
  1551. { WARNING: }
  1552. {  Any shell extensions which sends messages to those control windows }
  1553. { might not work in the future version of windows. If you really need }
  1554. { to send messages to them, (1) don't assume that those control window }
  1555. { always exist (i.e. GetControlWindow may fail) and (2) verify the window }
  1556. { class of the window before sending any messages. }
  1557.  
  1558.   {$EXTERNALSYM FCW_STATUS}
  1559.   FCW_STATUS          = $0001;
  1560.   {$EXTERNALSYM FCW_TOOLBAR}
  1561.   FCW_TOOLBAR         = $0002;
  1562.   {$EXTERNALSYM FCW_TREE}
  1563.   FCW_TREE            = $0003;
  1564.   {$EXTERNALSYM FCW_INTERNETBAR}
  1565.   FCW_INTERNETBAR     = $0006;
  1566.   {$EXTERNALSYM FCW_PROGRESS}
  1567.   FCW_PROGRESS        = $0008;
  1568.  
  1569.  
  1570. { Values for uFlags paremeter of ISB.SetToolbarItems member. }
  1571.  
  1572.   {$EXTERNALSYM FCT_MERGE}
  1573.   FCT_MERGE           = $0001;
  1574.   {$EXTERNALSYM FCT_CONFIGABLE}
  1575.   FCT_CONFIGABLE      = $0002;
  1576.   {$EXTERNALSYM FCT_ADDTOEND}
  1577.   FCT_ADDTOEND        = $0004;
  1578.  
  1579. { ICommDlgBrowser.OnStateChange values }
  1580.  
  1581.   {$EXTERNALSYM CDBOSC_SETFOCUS}
  1582.   CDBOSC_SETFOCUS         = $00000000;
  1583.   {$EXTERNALSYM CDBOSC_KILLFOCUS}
  1584.   CDBOSC_KILLFOCUS        = $00000001;
  1585.   {$EXTERNALSYM CDBOSC_SELCHANGE}
  1586.   CDBOSC_SELCHANGE        = $00000002;
  1587.   {$EXTERNALSYM CDBOSC_RENAME}
  1588.   CDBOSC_RENAME           = $00000003;
  1589.  
  1590. { shellview select item flags }
  1591.  
  1592.   {$EXTERNALSYM SVSI_DESELECT}
  1593.   SVSI_DESELECT           = $0000;
  1594.   {$EXTERNALSYM SVSI_SELECT}
  1595.   SVSI_SELECT             = $0001;
  1596.   {$EXTERNALSYM SVSI_EDIT}
  1597.   SVSI_EDIT               = $0003;  { includes select }
  1598.   {$EXTERNALSYM SVSI_DESELECTOTHERS}
  1599.   SVSI_DESELECTOTHERS     = $0004;
  1600.   {$EXTERNALSYM SVSI_ENSUREVISIBLE}
  1601.   SVSI_ENSUREVISIBLE      = $0008;
  1602.   {$EXTERNALSYM SVSI_FOCUSED}
  1603.   SVSI_FOCUSED            = $0010;
  1604.   {$EXTERNALSYM SVSI_TRANSLATEPT}
  1605.   SVSI_TRANSLATEPT        = $0020;
  1606.  
  1607. { shellview get item object flags }
  1608.  
  1609.   {$EXTERNALSYM SVGIO_BACKGROUND}
  1610.   SVGIO_BACKGROUND        = $00000000;
  1611.   {$EXTERNALSYM SVGIO_SELECTION}
  1612.   SVGIO_SELECTION         = $00000001;
  1613.   {$EXTERNALSYM SVGIO_ALLVIEW}
  1614.   SVGIO_ALLVIEW           = $00000002;
  1615.  
  1616. type
  1617.   {$EXTERNALSYM HOLEMENU}
  1618.   HOLEMENU = HGLOBAL; // !!! should this be in ole2.pas?
  1619.  
  1620.   IShellView = interface;
  1621.  
  1622.   {$EXTERNALSYM IShellBrowser}
  1623.   IShellBrowser = interface(IOleWindow)
  1624.     [SID_IShellBrowser]
  1625.     function InsertMenusSB(hMenuShared: HMENU;
  1626.       out MenuWidths: TOleMenuGroupWidths): HResult; stdcall;
  1627.     function SetMenuSB(hMenuShared: HMENU;
  1628.       hOleMenuReserved: HOLEMENU; hwndActiveObject: HWND): HResult; stdcall;
  1629.     function RemoveMenusSB(hMenuShared: HMENU): HResult; stdcall;
  1630.     function SetStatusTextSB(StatusText: POleStr): HResult; stdcall;
  1631.     function EnableModelessSB(Enable: BOOL): HResult; stdcall;
  1632.     function TranslateAcceleratorSB(Msg: PMsg; ID: Word): HResult; stdcall;
  1633.     function BrowseObject(pidl: PItemIDList; flags: UINT): HResult; stdcall;
  1634.     function GetViewStateStream(Mode: DWORD; out Stream: IStream): HResult; stdcall;
  1635.     function GetControlWindow(ID: UINT; out Wnd: HWND): HResult; stdcall;
  1636.     function SendControlMsg(ID, Msg: UINT; wParm: WPARAM; lParm: LPARAM;
  1637.       var Rslt: LResult): HResult; stdcall;
  1638.     function QueryActiveShellView(var ShellView: IShellView): HResult; stdcall;
  1639.     function OnViewWindowActive(var ShellView: IShellView): HResult; stdcall;
  1640.     function SetToolbarItems(TBButton: PTBButton;
  1641.       nButtons, uFlags: UINT): HResult; stdcall;
  1642.   end;
  1643.  
  1644.   {$EXTERNALSYM TSBSCEnums}
  1645.   TSBSCEnums = (SBSC_HIDE, SBSC_SHOW, SBSC_TOGGLE, SBSC_QUERY);
  1646.  
  1647.   {$EXTERNALSYM TSBOEnums}
  1648.   TSBOEnums = (SBO_DEFAULT, SBO_NOBROWSERPAGES);
  1649.  
  1650.  
  1651. { CommandTarget ids. }
  1652.   {$EXTERNALSYM TSBCMDIDEnums}
  1653.   TSBCMDIDEnums = (
  1654.     SBCMDID_ENABLESHOWTREE,
  1655.     SBCMDID_SHOWCONTROL,                { variant vt_i4 = loword = FCW_* hiword = SBSC_* }
  1656.     SBCMDID_CANCELNAVIGATION,           { cancel last navigation }
  1657.     SBCMDID_MAYSAVECHANGES,             { about to close and may save changes }
  1658.     SBCMDID_SETHLINKFRAME,              { variant vt_i4 = phlinkframe }
  1659.     SBCMDID_ENABLESTOP,                 { variant vt_bool = fEnable }
  1660.     SBCMDID_OPTIONS                     { the view.options page }
  1661.   );
  1662.  
  1663.  
  1664. { ICommDlgBrowser interface }
  1665.  
  1666. {  ICommDlgBrowser interface is the interface that is provided by the new }
  1667. { common dialog window to hook and modify the behavior of IShellView.  When }
  1668. { a default view is created, it queries its parent IShellBrowser for the }
  1669. { ICommDlgBrowser interface.  If supported, it calls out to that interface }
  1670. { in several cases that need to behave differently in a dialog. }
  1671.  
  1672. { Member functions: }
  1673.  
  1674. {  ICommDlgBrowser.OnDefaultCommand() }
  1675. {    Called when the user double-clicks in the view or presses Enter.  The }
  1676. {   browser should return S_OK if it processed the action itself, S_FALSE }
  1677. {   to let the view perform the default action. }
  1678.  
  1679. {  ICommDlgBrowser.OnStateChange(ULONG uChange) }
  1680. {    Called when some states in the view change.  'uChange' is one of the }
  1681. {   CDBOSC_* values.  This call is made after the state (selection, focus, }
  1682. {   etc) has changed.  There is no return value. }
  1683.  
  1684. {  ICommDlgBrowser.IncludeObject(LPCITEMIDLIST pidl) }
  1685. {    Called when the view is enumerating objects.  'pidl' is a relative }
  1686. {   IDLIST.  The browser should return S_OK to include the object in the }
  1687. {   view, S_FALSE to hide it }
  1688.  
  1689. { ------------------------------------------------------------------------- }
  1690.  
  1691.   {$EXTERNALSYM ICommDlgBrowser}
  1692.   ICommDlgBrowser = interface(IUnknown)
  1693.     [SID_ICommDlgBrowser]
  1694.     function OnDefaultCommand(const ppshv: IShellView): HResult; stdcall;
  1695.     function OnStateChange(const ppshv: IShellView; Change: ULONG): HResult; stdcall;
  1696.     function IncludeObject(const ppshv: IShellView; pidl: PItemIDList): HResult; stdcall;
  1697.   end;
  1698.  
  1699.  
  1700. { Interface:   IShellView }
  1701.  
  1702. { IShellView.ContextSensitiveHelp(fEnterMode) }
  1703.  
  1704. {   Inherited from IOleWindow.ContextSensitiveHelp. }
  1705.  
  1706.  
  1707. { IShellView.TranslateAccelerator(lpmsg) }
  1708.  
  1709. {   Similar to IOleInPlaceActiveObject.TranlateAccelerator. The explorer }
  1710. {  calls this function BEFORE any other translation. Returning S_OK }
  1711. {  indicates that the message was translated (eaten) and should not be }
  1712. {  translated or dispatched by the explorer. }
  1713.  
  1714.  
  1715. { IShellView.EnableModeless(fEnable) }
  1716.  
  1717. {   Similar to IOleInPlaceActiveObject.EnableModeless. }
  1718.  
  1719.  
  1720. { IShellView.UIActivate(uState) }
  1721.  
  1722. {   The explorer calls this member function whenever the activation }
  1723. {  state of the view window is changed by a certain event that is }
  1724. {  NOT caused by the shell view itself. }
  1725.  
  1726. {   SVUIA_DEACTIVATE will be passed when the explorer is about to }
  1727. {  destroy the shell view window; the shell view is supposed to remove }
  1728. {  all the extended UIs (typically merged menu and modeless popup windows). }
  1729.  
  1730. {   SVUIA_ACTIVATE_NOFOCUS will be passsed when the shell view is losing }
  1731. {  the input focus or the shell view has been just created without the }
  1732. {  input focus; the shell view is supposed to set menuitems appropriate }
  1733. {  for non-focused state (no selection specific items should be added). }
  1734.  
  1735. {   SVUIA_ACTIVATE_FOCUS will be passed when the explorer has just }
  1736. {  created the view window with the input focus; the shell view is }
  1737. {  supposed to set menuitems appropriate for focused state. }
  1738.  
  1739. {   SVUIA_INPLACEACTIVATE(new) will be passed when the shell view is opened }
  1740. {  within an ActiveX control, which is not a UI active. In this case, }
  1741. {  the shell view should not merge menus or put toolbas. To be compatible }
  1742. {  with Win95 client, we don't pass this value unless the view supports }
  1743. {  IShellView2. }
  1744.  
  1745. {   The shell view should not change focus within this member function. }
  1746. {  The shell view should not hook the WM_KILLFOCUS message to remerge }
  1747. {  menuitems. However, the shell view typically hook the WM_SETFOCUS }
  1748. {  message, and re-merge the menu after calling IShellBrowser. }
  1749. {  OnViewWindowActivated. }
  1750.  
  1751.  
  1752. { IShellView.Refresh() }
  1753.  
  1754. {   The explorer calls this member when the view needs to refresh its }
  1755. {  contents (such as when the user hits F5 key). }
  1756.  
  1757.  
  1758. { IShellView.CreateViewWindow }
  1759.  
  1760. {   This member creates the view window (right-pane of the explorer or the }
  1761. {  client window of the folder window). }
  1762.  
  1763.  
  1764. { IShellView.DestroyViewWindow }
  1765.  
  1766. {   This member destroys the view window. }
  1767.  
  1768.  
  1769. { IShellView.GetCurrentInfo }
  1770.  
  1771. {   This member returns the folder settings. }
  1772.  
  1773.  
  1774. { IShellView.AddPropertySHeetPages }
  1775.  
  1776. {   The explorer calls this member when it is opening the option property }
  1777. {  sheet. This allows the view to add additional pages to it. }
  1778.  
  1779.  
  1780. { IShellView.SaveViewState() }
  1781.  
  1782. {   The explorer calls this member when the shell view is supposed to }
  1783. {  store its view settings. The shell view is supposed to get a view }
  1784. {  stream by calling IShellBrowser.GetViewStateStream and store the }
  1785. {  current view state into that stream. }
  1786.  
  1787.  
  1788. { IShellView.SelectItem(pidlItem, uFlags) }
  1789.  
  1790. {   The explorer calls this member to change the selection state of }
  1791. {  item(s) within the shell view window.  If pidlItem is NULL and uFlags }
  1792. {  is SVSI_DESELECTOTHERS, all items should be deselected. }
  1793.  
  1794. { ------------------------------------------------------------------------- }
  1795.  
  1796. { uState values for IShellView.UIActivate }
  1797.  
  1798.   {$EXTERNALSYM TSVUIAEnums}
  1799.   TSVUIAEnums = (
  1800.     SVUIA_DEACTIVATE,
  1801.     SVUIA_ACTIVATE_NOFOCUS,
  1802.     SVUIA_ACTIVATE_FOCUS,
  1803.     SVUIA_INPLACEACTIVATE               { new flag for IShellView2 }
  1804.   );
  1805.  
  1806.   {$EXTERNALSYM IShellView}
  1807.   IShellView = interface(IOleWindow)
  1808.     [SID_IShellView]
  1809.     function TranslateAccelerator(var Msg: TMsg): HResult; stdcall;
  1810.     function EnableModeless(Enable: Boolean): HResult; stdcall;
  1811.     function UIActivate(State: UINT): HResult; stdcall;
  1812.     function Refresh: HResult; stdcall;
  1813.     function CreateViewWindow(PrevView: IShellView;
  1814.       var FolderSettings: TFolderSettings; ShellBrowser: IShellBrowser;
  1815.       var Rect: TRect; out Wnd: HWND): HResult; stdcall;
  1816.     function DestroyViewWindow: HResult; stdcall;
  1817.     function GetCurrentInfo(out FolderSettings: TFolderSettings): HResult; stdcall;
  1818.     function AddPropertySheetPages(Reseved: DWORD;
  1819.       var lpfnAddPage: TFNAddPropSheetPage; lParam: LPARAM): HResult; stdcall;
  1820.     function SaveViewState: HResult; stdcall;
  1821.     function SelectItem(pidl: PItemIDList; flags: UINT): HResult; stdcall;
  1822.     function GetItemObject(Item: UINT; const iid: TIID; var IPtr: Pointer): HResult; stdcall;
  1823.   end;
  1824.  
  1825. const
  1826.   {$EXTERNALSYM SV2GV_CURRENTVIEW}
  1827.   SV2GV_CURRENTVIEW     = -1;
  1828.   {$EXTERNALSYM SV2GV_DEFAULTVIEW}
  1829.   SV2GV_DEFAULTVIEW     = -2;
  1830.  
  1831. type
  1832.   {$EXTERNALSYM SHELLVIEWID}
  1833.   SHELLVIEWID = TGUID;
  1834.   TShellViewID = SHELLVIEWID;
  1835.   PShellViewID = ^TShellViewID;
  1836.  
  1837.   PSV2CreateParams = ^TSV2CreateParams;
  1838.   {$EXTERNALSYM _SV2CVW2_PARAMS}
  1839.   _SV2CVW2_PARAMS = record
  1840.     cbSize: DWORD;
  1841.     psvPrev: IShellView;
  1842.     pfs: PFolderSettings;
  1843.     psbOwner: IShellBrowser;
  1844.     prcView: PRect;
  1845.     pvid: PShellViewID;
  1846.     hwndView: HWND;
  1847.   end;
  1848.   TSV2CreateParams = _SV2CVW2_PARAMS;
  1849.   {$EXTERNALSYM SV2CVW2_PARAMS}
  1850.   SV2CVW2_PARAMS = _SV2CVW2_PARAMS;
  1851.  
  1852.  
  1853.   {$EXTERNALSYM IShellView2}
  1854.   IShellView2 = interface(IShellView)
  1855.     [SID_IShellView2]
  1856.     function GetView(pvid: PShellViewID; uView: ULONG): HResult; stdcall;
  1857.     function CreateViewWindow2(SV2CreateParams: PSV2CreateParams): HResult; stdcall;
  1858.     function HandleRename(pidlNew: PItemIDList): HResult; stdcall;
  1859.     function SelectAndPositionItem(pidlItem: PItemIDList; uFlags: UINT;
  1860.       var Point: TPoint): HResult; stdcall;
  1861.   end;
  1862.  
  1863. { ------------------------------------------------------------------------- }
  1864.  
  1865. const
  1866.   {$EXTERNALSYM STRRET_WSTR}
  1867.   STRRET_WSTR         = $0000;          { Use STRRET.pOleStr }
  1868.   {$EXTERNALSYM STRRET_OFFSET}
  1869.   STRRET_OFFSET       = $0001;          { Use STRRET.uOffset to Ansi }
  1870.   {$EXTERNALSYM STRRET_CSTR}
  1871.   STRRET_CSTR         = $0002;          { Use STRRET.cStr }
  1872.  
  1873. type
  1874. { record for returning strings from IShellFolder member functions }
  1875.  
  1876.   PSTRRet = ^TStrRet;
  1877.   {$EXTERNALSYM _STRRET}
  1878.   _STRRET = record
  1879.      uType: UINT;              { One of the STRRET_* values }
  1880.      case Integer of
  1881.        0: (pOleStr: LPWSTR);                    { must be freed by caller of GetDisplayNameOf }
  1882.        1: (pStr: LPSTR);                        { NOT USED }
  1883.        2: (uOffset: UINT);                      { Offset into SHITEMID (ANSI) }
  1884.        3: (cStr: array[0..MAX_PATH-1] of Char); { Buffer to fill in }
  1885.     end;
  1886.   TStrRet = _STRRET;
  1887.   {$EXTERNALSYM STRRET}
  1888.   STRRET = _STRRET;
  1889.  
  1890.  { IShellDetails is supported on Win9x and NT4; for >= NT5 use IShellFolder2 }
  1891.   PShellDetails = ^TShellDetails;
  1892.   {$EXTERNALSYM _SHELLDETAILS}
  1893.   _SHELLDETAILS = record
  1894.     fmt,
  1895.     cxChar: Integer;
  1896.     str: STRRET;
  1897.   end;
  1898.   TShellDetails = _SHELLDETAILS;
  1899.   {$EXTERNALSYM SHELLDETAILS}
  1900.   SHELLDETAILS = _SHELLDETAILS;
  1901.  
  1902.   IShellDetails = interface(IUnknown)
  1903.     [SID_IShellDetails]
  1904.     function GetDetailsOf(pidl: PItemIDList; iColumn: UINT;
  1905.       var pDetails: TShellDetails): HResult; stdcall;
  1906.     function ColumnClick(iColumn: UINT): HResult; stdcall;
  1907.   end;
  1908.  
  1909. { SHGetPathFromIDList }
  1910.  
  1911. { This function assumes the size of the buffer (MAX_PATH). The pidl
  1912.   should point to a file system object. }
  1913.  
  1914. {$EXTERNALSYM SHGetPathFromIDList}
  1915. function SHGetPathFromIDList(pidl: PItemIDList; pszPath: PChar): BOOL; stdcall;
  1916. {$EXTERNALSYM SHGetPathFromIDListA}
  1917. function SHGetPathFromIDListA(pidl: PItemIDList; pszPath: PAnsiChar): BOOL; stdcall;
  1918. {$EXTERNALSYM SHGetPathFromIDListW}
  1919. function SHGetPathFromIDListW(pidl: PItemIDList; pszPath: PWideChar): BOOL; stdcall;
  1920.  
  1921. { SHGetSpecialFolderLocation }
  1922.  
  1923. { Caller should use SHGetMalloc to obtain an allocator that can free the pidl }
  1924.  
  1925. const
  1926. { registry entries for special paths are kept in : }
  1927.  
  1928.   {$EXTERNALSYM REGSTR_PATH_SPECIAL_FOLDERS}
  1929.   REGSTR_PATH_SPECIAL_FOLDERS   = REGSTR_PATH_EXPLORER + '\Shell Folders';
  1930.   {$EXTERNALSYM CSIDL_DESKTOP}
  1931.   CSIDL_DESKTOP                       = $0000;
  1932.   {$EXTERNALSYM CSIDL_INTERNET}
  1933.   CSIDL_INTERNET                      = $0001;
  1934.   {$EXTERNALSYM CSIDL_PROGRAMS}
  1935.   CSIDL_PROGRAMS                      = $0002;
  1936.   {$EXTERNALSYM CSIDL_CONTROLS}
  1937.   CSIDL_CONTROLS                      = $0003;
  1938.   {$EXTERNALSYM CSIDL_PRINTERS}
  1939.   CSIDL_PRINTERS                      = $0004;
  1940.   {$EXTERNALSYM CSIDL_PERSONAL}
  1941.   CSIDL_PERSONAL                      = $0005;
  1942.   {$EXTERNALSYM CSIDL_FAVORITES}
  1943.   CSIDL_FAVORITES                     = $0006;
  1944.   {$EXTERNALSYM CSIDL_STARTUP}
  1945.   CSIDL_STARTUP                       = $0007;
  1946.   {$EXTERNALSYM CSIDL_RECENT}
  1947.   CSIDL_RECENT                        = $0008;
  1948.   {$EXTERNALSYM CSIDL_SENDTO}
  1949.   CSIDL_SENDTO                        = $0009;
  1950.   {$EXTERNALSYM CSIDL_BITBUCKET}
  1951.   CSIDL_BITBUCKET                     = $000a;
  1952.   {$EXTERNALSYM CSIDL_STARTMENU}
  1953.   CSIDL_STARTMENU                     = $000b;
  1954.   {$EXTERNALSYM CSIDL_DESKTOPDIRECTORY}
  1955.   CSIDL_DESKTOPDIRECTORY              = $0010;
  1956.   {$EXTERNALSYM CSIDL_DRIVES}
  1957.   CSIDL_DRIVES                        = $0011;
  1958.   {$EXTERNALSYM CSIDL_NETWORK}
  1959.   CSIDL_NETWORK                       = $0012;
  1960.   {$EXTERNALSYM CSIDL_NETHOOD}
  1961.   CSIDL_NETHOOD                       = $0013;
  1962.   {$EXTERNALSYM CSIDL_FONTS}
  1963.   CSIDL_FONTS                         = $0014;
  1964.   {$EXTERNALSYM CSIDL_TEMPLATES}
  1965.   CSIDL_TEMPLATES                     = $0015;
  1966.   {$EXTERNALSYM CSIDL_COMMON_STARTMENU}
  1967.   CSIDL_COMMON_STARTMENU              = $0016;
  1968.   {$EXTERNALSYM CSIDL_COMMON_PROGRAMS}
  1969.   CSIDL_COMMON_PROGRAMS               = $0017;
  1970.   {$EXTERNALSYM CSIDL_COMMON_STARTUP}
  1971.   CSIDL_COMMON_STARTUP                = $0018;
  1972.   {$EXTERNALSYM CSIDL_COMMON_DESKTOPDIRECTORY}
  1973.   CSIDL_COMMON_DESKTOPDIRECTORY       = $0019;
  1974.   {$EXTERNALSYM CSIDL_APPDATA}
  1975.   CSIDL_APPDATA                       = $001a;
  1976.   {$EXTERNALSYM CSIDL_PRINTHOOD}
  1977.   CSIDL_PRINTHOOD                     = $001b;
  1978.   {$EXTERNALSYM CSIDL_ALTSTARTUP}
  1979.   CSIDL_ALTSTARTUP                = $001d;         // DBCS
  1980.   {$EXTERNALSYM CSIDL_COMMON_ALTSTARTUP}
  1981.   CSIDL_COMMON_ALTSTARTUP         = $001e;         // DBCS
  1982.   {$EXTERNALSYM CSIDL_COMMON_FAVORITES}
  1983.   CSIDL_COMMON_FAVORITES          = $001f;
  1984.   {$EXTERNALSYM CSIDL_INTERNET_CACHE}
  1985.   CSIDL_INTERNET_CACHE            = $0020;
  1986.   {$EXTERNALSYM CSIDL_COOKIES}
  1987.   CSIDL_COOKIES                   = $0021;
  1988.   {$EXTERNALSYM CSIDL_HISTORY}
  1989.   CSIDL_HISTORY                   = $0022;
  1990.  
  1991. {$EXTERNALSYM SHGetSpecialFolderLocation}
  1992. function SHGetSpecialFolderLocation(hwndOwner: HWND; nFolder: Integer;
  1993.   var ppidl: PItemIDList): HResult; stdcall;
  1994.  
  1995. function SHGetSpecialFolderPath(hwndOwner: HWND; lpszPath: PChar;
  1996.   nFolder: Integer; fCreate: BOOL): BOOL; stdcall;
  1997. {$EXTERNALSYM SHGetSpecialFolderPath}
  1998. function SHGetSpecialFolderPathA(hwndOwner: HWND; lpszPath: PAnsiChar;
  1999.   nFolder: Integer; fCreate: BOOL): BOOL; stdcall;
  2000. {$EXTERNALSYM SHGetSpecialFolderPathA}
  2001. function SHGetSpecialFolderPathW(hwndOwner: HWND; lpszPath: PWideChar;
  2002.   nFolder: Integer; fCreate: BOOL): BOOL; stdcall;
  2003. {$EXTERNALSYM SHGetSpecialFolderPathW}
  2004.  
  2005. { SHBrowseForFolder API }
  2006.  
  2007. type
  2008.   {$EXTERNALSYM BFFCALLBACK}
  2009.   BFFCALLBACK = function(Wnd: HWND; uMsg: UINT; lParam, lpData: LPARAM): Integer stdcall;
  2010.   TFNBFFCallBack = type BFFCALLBACK;
  2011.  
  2012.   PBrowseInfoA = ^TBrowseInfoA;
  2013.   PBrowseInfoW = ^TBrowseInfoW;
  2014.   PBrowseInfo = PBrowseInfoA;
  2015.   {$EXTERNALSYM _browseinfoA}
  2016.   _browseinfoA = record
  2017.     hwndOwner: HWND;
  2018.     pidlRoot: PItemIDList;
  2019.     pszDisplayName: PAnsiChar;  { Return display name of item selected. }
  2020.     lpszTitle: PAnsiChar;      { text to go in the banner over the tree. }
  2021.     ulFlags: UINT;           { Flags that control the return stuff }
  2022.     lpfn: TFNBFFCallBack;
  2023.     lParam: LPARAM;          { extra info that's passed back in callbacks }
  2024.     iImage: Integer;         { output var: where to return the Image index. }
  2025.   end;
  2026.   {$EXTERNALSYM _browseinfoW}
  2027.   _browseinfoW = record
  2028.     hwndOwner: HWND;
  2029.     pidlRoot: PItemIDList;
  2030.     pszDisplayName: PWideChar;  { Return display name of item selected. }
  2031.     lpszTitle: PWideChar;      { text to go in the banner over the tree. }
  2032.     ulFlags: UINT;           { Flags that control the return stuff }
  2033.     lpfn: TFNBFFCallBack;
  2034.     lParam: LPARAM;          { extra info that's passed back in callbacks }
  2035.     iImage: Integer;         { output var: where to return the Image index. }
  2036.   end;
  2037.   {$EXTERNALSYM _browseinfo}
  2038.   _browseinfo = _browseinfoA;
  2039.   TBrowseInfoA = _browseinfoA;
  2040.   TBrowseInfoW = _browseinfoW;
  2041.   TBrowseInfo = TBrowseInfoA;
  2042.   {$EXTERNALSYM BROWSEINFOA}
  2043.   BROWSEINFOA = _browseinfoA;
  2044.   {$EXTERNALSYM BROWSEINFOW}
  2045.   BROWSEINFOW = _browseinfoW;
  2046.   {$EXTERNALSYM BROWSEINFO}
  2047.   BROWSEINFO = BROWSEINFOA;
  2048.  
  2049. const
  2050. { Browsing for directory. }
  2051.  
  2052.   {$EXTERNALSYM BIF_RETURNONLYFSDIRS}
  2053.   BIF_RETURNONLYFSDIRS   = $0001;  { For finding a folder to start document searching }
  2054.   {$EXTERNALSYM BIF_DONTGOBELOWDOMAIN}
  2055.   BIF_DONTGOBELOWDOMAIN  = $0002;  { For starting the Find Computer }
  2056.   {$EXTERNALSYM BIF_STATUSTEXT}
  2057.   BIF_STATUSTEXT         = $0004;
  2058.   {$EXTERNALSYM BIF_RETURNFSANCESTORS}
  2059.   BIF_RETURNFSANCESTORS  = $0008;
  2060.   {$EXTERNALSYM BIF_EDITBOX}
  2061.   BIF_EDITBOX            = $0010;
  2062.   {$EXTERNALSYM BIF_VALIDATE}
  2063.   BIF_VALIDATE           = $0020;  { insist on valid result (or CANCEL) }
  2064.  
  2065.   {$EXTERNALSYM BIF_BROWSEFORCOMPUTER}
  2066.   BIF_BROWSEFORCOMPUTER  = $1000;  { Browsing for Computers. }
  2067.   {$EXTERNALSYM BIF_BROWSEFORPRINTER}
  2068.   BIF_BROWSEFORPRINTER   = $2000;  { Browsing for Printers }
  2069.   {$EXTERNALSYM BIF_BROWSEINCLUDEFILES}
  2070.   BIF_BROWSEINCLUDEFILES = $4000;  { Browsing for Everything }
  2071.  
  2072. { message from browser }
  2073.  
  2074.   {$EXTERNALSYM BFFM_INITIALIZED}
  2075.   BFFM_INITIALIZED       = 1;
  2076.   {$EXTERNALSYM BFFM_SELCHANGED}
  2077.   BFFM_SELCHANGED        = 2;
  2078.   {$EXTERNALSYM BFFM_VALIDATEFAILEDA}
  2079.   BFFM_VALIDATEFAILEDA   = 3;   { lParam:szPath ret:1(cont),0(EndDialog) }
  2080.   {$EXTERNALSYM BFFM_VALIDATEFAILEDW}
  2081.   BFFM_VALIDATEFAILEDW   = 4;   { lParam:wzPath ret:1(cont),0(EndDialog) }
  2082.  
  2083. { messages to browser }
  2084.  
  2085.   {$EXTERNALSYM BFFM_SETSTATUSTEXTA}
  2086.   BFFM_SETSTATUSTEXTA         = WM_USER + 100;
  2087.   {$EXTERNALSYM BFFM_ENABLEOK}
  2088.   BFFM_ENABLEOK               = WM_USER + 101;
  2089.   {$EXTERNALSYM BFFM_SETSELECTIONA}
  2090.   BFFM_SETSELECTIONA          = WM_USER + 102;
  2091.   {$EXTERNALSYM BFFM_SETSELECTIONW}
  2092.   BFFM_SETSELECTIONW          = WM_USER + 103;
  2093.   {$EXTERNALSYM BFFM_SETSTATUSTEXTW}
  2094.   BFFM_SETSTATUSTEXTW         = WM_USER + 104;
  2095.  
  2096.  
  2097.  
  2098.  
  2099.  
  2100.  
  2101.  
  2102.  
  2103.  
  2104.   {$EXTERNALSYM BFFM_VALIDATEFAILED}
  2105.   BFFM_VALIDATEFAILED     = BFFM_VALIDATEFAILEDA;
  2106.   {$EXTERNALSYM BFFM_SETSTATUSTEXT}
  2107.   BFFM_SETSTATUSTEXT      = BFFM_SETSTATUSTEXTA;
  2108.   {$EXTERNALSYM BFFM_SETSELECTION}
  2109.   BFFM_SETSELECTION       = BFFM_SETSELECTIONA;
  2110.  
  2111.  
  2112. {$EXTERNALSYM SHBrowseForFolder}
  2113. function SHBrowseForFolder(var lpbi: TBrowseInfo): PItemIDList; stdcall;
  2114. {$EXTERNALSYM SHBrowseForFolderA}
  2115. function SHBrowseForFolderA(var lpbi: TBrowseInfoA): PItemIDList; stdcall;
  2116. {$EXTERNALSYM SHBrowseForFolderW}
  2117. function SHBrowseForFolderW(var lpbi: TBrowseInfoW): PItemIDList; stdcall;
  2118.  
  2119. { SHLoadInProc }
  2120.  
  2121. { When this function is called, the shell calls CoCreateInstance
  2122.   (or equivalent) with CLSCTX_INPROC_SERVER and the specified CLSID
  2123.   from within the shell's process and release it immediately. }
  2124.  
  2125. {$EXTERNALSYM SHLoadInProc}
  2126. function SHLoadInProc(rclsid: TCLSID): HRESULT; stdcall;
  2127.  
  2128. { IEnumIDList interface }
  2129.  
  2130. { IShellFolder.EnumObjects member returns an IEnumIDList object. }
  2131.  
  2132. type
  2133.   {$EXTERNALSYM IEnumIDList}
  2134.   IEnumIDList = interface(IUnknown)
  2135.     [SID_IEnumIDList]
  2136.     function Next(celt: ULONG; out rgelt: PItemIDList;
  2137.       var pceltFetched: ULONG): HResult; stdcall;
  2138.     function Skip(celt: ULONG): HResult; stdcall;
  2139.     function Reset: HResult; stdcall;
  2140.     function Clone(out ppenum: IEnumIDList): HResult; stdcall;
  2141.   end;
  2142.  
  2143. { IShellFolder interface }
  2144.  
  2145. { [Member functions] }
  2146.  
  2147. { IShellFolder.BindToObject(pidl, pbc, riid, ppvOut)
  2148.   This function returns an instance of a sub-folder which is specified
  2149.   by the IDList (pidl).
  2150.  IShellFolder.BindToStorage(pidl, pbc, riid, ppvObj)
  2151.    This function returns a storage instance of a sub-folder which is
  2152.    specified by the IDList (pidl). The shell never calls this member
  2153.    function in the first release of Win95.
  2154.  IShellFolder.CompareIDs(lParam, pidl1, pidl2)
  2155.    This function compares two IDLists and returns the result. The shell
  2156.    explorer always passes 0 as lParam, which indicates 'sort by name'.
  2157.    It should return 0 (as CODE of the scode), if two id indicates the
  2158.    same object; negative value if pidl1 should be placed before pidl2;
  2159.    positive value if pidl2 should be placed before pidl1.
  2160.  IShellFolder.CreateViewObject(hwndOwner, riid, ppvOut)
  2161.    This function creates a view object of the folder itself. The view
  2162.    object is a difference instance from the shell folder object.
  2163.    "hwndOwner" can be used  as the owner window of its dialog box or
  2164.       menu during the lifetime of the view object.
  2165.    instance which has only one reference count. The explorer may create
  2166.    more than one instances of view object from one shell folder object
  2167.    and treat them as separate instances.
  2168.  IShellFolder.GetAttributesOf(cidl, apidl, prgfInOut)
  2169.    This function returns the attributes of specified objects in that
  2170.    folder. 'cidl' and 'apidl' specifies objects. 'apidl' contains only
  2171.    simple IDLists. The explorer initializes *prgfInOut with a set of
  2172.    flags to be evaluated. The shell folder may optimize the operation
  2173.    by not returning unspecified flags.
  2174.  IShellFolder.GetUIObjectOf(hwndOwner, cidl, apidl, riid, prgfInOut, ppvOut)
  2175.    This function creates a UI object to be used for specified objects.
  2176.    The shell explorer passes either IID_IDataObject (for transfer operation)
  2177.    or IID_IContextMenu (for context menu operation) as riid.
  2178.  IShellFolder.GetDisplayNameOf
  2179.    This function returns the display name of the specified object.
  2180.    If the ID contains the display name (in the locale character set),
  2181.    it returns the offset to the name. Otherwise, it returns a pointer
  2182.    to the display name string (UNICODE), which is allocated by the
  2183.    task allocator, or fills in a buffer.
  2184.  IShellFolder.SetNameOf
  2185.    This function sets the display name of the specified object.
  2186.    If it changes the ID as well, it returns the new ID which is
  2187.    alocated by the task allocator. }
  2188.  
  2189. const
  2190. { IShellFolder.GetDisplayNameOf/SetNameOf uFlags }
  2191.  
  2192.   {$EXTERNALSYM SHGDN_NORMAL}
  2193.   SHGDN_NORMAL           = 0;         { default (display purpose) }
  2194.   {$EXTERNALSYM SHGDN_INFOLDER}
  2195.   SHGDN_INFOLDER         = 1;         { displayed under a folder (relative) }
  2196.  
  2197.   {$EXTERNALSYM SHGDN_FOREDITING}
  2198.   SHGDN_FOREDITING       = $1000;     { for in-place editing text }
  2199.   {$EXTERNALSYM SHGDN_INCLUDE_NONFILESYS}
  2200.   SHGDN_INCLUDE_NONFILESYS = $2000;   { if not set, display names for shell
  2201.                                         name space items that are not in the
  2202.                                         file system will fail. }
  2203.   {$EXTERNALSYM SHGDN_FORADDRESSBAR}
  2204.   SHGDN_FORADDRESSBAR      = $4000;     { for displaying in the address (drives dropdown) bar }
  2205.   {$EXTERNALSYM SHGDN_FORPARSING}
  2206.   SHGDN_FORPARSING         = $8000;     { for ParseDisplayName or path }
  2207.  
  2208. { IShellFolder.EnumObjects }
  2209.  
  2210.   {$EXTERNALSYM SHCONTF_FOLDERS}
  2211.   SHCONTF_FOLDERS         = 32;       { for shell browser }
  2212.   {$EXTERNALSYM SHCONTF_NONFOLDERS}
  2213.   SHCONTF_NONFOLDERS      = 64;       { for default view }
  2214.   {$EXTERNALSYM SHCONTF_INCLUDEHIDDEN}
  2215.   SHCONTF_INCLUDEHIDDEN   = 128;      { for hidden/system objects }
  2216.  
  2217. { IShellFolder.GetAttributesOf flags }
  2218.  
  2219.   {$EXTERNALSYM SFGAO_CANCOPY}
  2220.   SFGAO_CANCOPY           = DROPEFFECT_COPY; { Objects can be copied }
  2221.   {$EXTERNALSYM SFGAO_CANMOVE}
  2222.   SFGAO_CANMOVE           = DROPEFFECT_MOVE; { Objects can be moved }
  2223.   {$EXTERNALSYM SFGAO_CANLINK}
  2224.   SFGAO_CANLINK           = DROPEFFECT_LINK; { Objects can be linked }
  2225.   {$EXTERNALSYM SFGAO_CANRENAME}
  2226.   SFGAO_CANRENAME         = $00000010;       { Objects can be renamed }
  2227.   {$EXTERNALSYM SFGAO_CANDELETE}
  2228.   SFGAO_CANDELETE         = $00000020;       { Objects can be deleted }
  2229.   {$EXTERNALSYM SFGAO_HASPROPSHEET}
  2230.   SFGAO_HASPROPSHEET      = $00000040;       { Objects have property sheets }
  2231.   {$EXTERNALSYM SFGAO_DROPTARGET}
  2232.   SFGAO_DROPTARGET        = $00000100;       { Objects are drop target }
  2233.   {$EXTERNALSYM SFGAO_CAPABILITYMASK}
  2234.   SFGAO_CAPABILITYMASK    = $00000177;
  2235.   {$EXTERNALSYM SFGAO_LINK}
  2236.   SFGAO_LINK              = $00010000;       { Shortcut (link) }
  2237.   {$EXTERNALSYM SFGAO_SHARE}
  2238.   SFGAO_SHARE             = $00020000;       { shared }
  2239.   {$EXTERNALSYM SFGAO_READONLY}
  2240.   SFGAO_READONLY          = $00040000;       { read-only }
  2241.   {$EXTERNALSYM SFGAO_GHOSTED}
  2242.   SFGAO_GHOSTED           = $00080000;       { ghosted icon }
  2243.   {$EXTERNALSYM SFGAO_HIDDEN}
  2244.   SFGAO_HIDDEN            = $00080000;       { hidden object }
  2245.   {$EXTERNALSYM SFGAO_DISPLAYATTRMASK}
  2246.   SFGAO_DISPLAYATTRMASK   = $000F0000;
  2247.   {$EXTERNALSYM SFGAO_FILESYSANCESTOR}
  2248.   SFGAO_FILESYSANCESTOR   = $10000000;       { It contains file system folder }
  2249.   {$EXTERNALSYM SFGAO_FOLDER}
  2250.   SFGAO_FOLDER            = $20000000;       { It's a folder. }
  2251.   {$EXTERNALSYM SFGAO_FILESYSTEM}
  2252.   SFGAO_FILESYSTEM        = $40000000;       { is a file system thing (file/folder/root) }
  2253.   {$EXTERNALSYM SFGAO_HASSUBFOLDER}
  2254.   SFGAO_HASSUBFOLDER      = $80000000;       { Expandable in the map pane }
  2255.   {$EXTERNALSYM SFGAO_CONTENTSMASK}
  2256.   SFGAO_CONTENTSMASK      = $80000000;
  2257.   {$EXTERNALSYM SFGAO_VALIDATE}
  2258.   SFGAO_VALIDATE          = $01000000;       { invalidate cached information }
  2259.   {$EXTERNALSYM SFGAO_REMOVABLE}
  2260.   SFGAO_REMOVABLE         = $02000000;       { is this removeable media? }
  2261.   {$EXTERNALSYM SFGAO_COMPRESSED}
  2262.   SFGAO_COMPRESSED        = $04000000;       { Object is compressed (use alt color) }
  2263.   {$EXTERNALSYM SFGAO_BROWSABLE}
  2264.   SFGAO_BROWSABLE         = $08000000;       { is in-place browsable }
  2265.   {$EXTERNALSYM SFGAO_NONENUMERATED}
  2266.   SFGAO_NONENUMERATED     = $00100000;       { is a non-enumerated object }
  2267.   {$EXTERNALSYM SFGAO_NEWCONTENT}
  2268.   SFGAO_NEWCONTENT        = $00200000;       { should show bold in explorer tree }
  2269.  
  2270. type
  2271.   {$EXTERNALSYM IShellFolder}
  2272.   IShellFolder = interface(IUnknown)
  2273.     [SID_IShellFolder]
  2274.     function ParseDisplayName(hwndOwner: HWND;
  2275.       pbcReserved: Pointer; lpszDisplayName: POLESTR; out pchEaten: ULONG;
  2276.       out ppidl: PItemIDList; var dwAttributes: ULONG): HResult; stdcall;
  2277.     function EnumObjects(hwndOwner: HWND; grfFlags: DWORD;
  2278.       out EnumIDList: IEnumIDList): HResult; stdcall;
  2279.     function BindToObject(pidl: PItemIDList; pbcReserved: Pointer;
  2280.       const riid: TIID; out ppvOut): HResult; stdcall;
  2281.     function BindToStorage(pidl: PItemIDList; pbcReserved: Pointer;
  2282.       const riid: TIID; out ppvObj): HResult; stdcall;
  2283.     function CompareIDs(lParam: LPARAM;
  2284.       pidl1, pidl2: PItemIDList): HResult; stdcall;
  2285.     function CreateViewObject(hwndOwner: HWND; const riid: TIID;
  2286.       out ppvOut): HResult; stdcall;
  2287.     function GetAttributesOf(cidl: UINT; var apidl: PItemIDList;
  2288.       var rgfInOut: UINT): HResult; stdcall;
  2289.     function GetUIObjectOf(hwndOwner: HWND; cidl: UINT; var apidl: PItemIDList;
  2290.       const riid: TIID; prgfInOut: Pointer; out ppvOut): HResult; stdcall;
  2291.     function GetDisplayNameOf(pidl: PItemIDList; uFlags: DWORD;
  2292.       var lpName: TStrRet): HResult; stdcall;
  2293.     function SetNameOf(hwndOwner: HWND; pidl: PItemIDList; lpszName: POLEStr;
  2294.       uFlags: DWORD; var ppidlOut: PItemIDList): HResult; stdcall;
  2295.   end;
  2296.  
  2297.   {$EXTERNALSYM PExtraSearch}
  2298.   PExtraSearch = ^TExtraSearch;
  2299.   {$EXTERNALSYM tagExtraSearch}
  2300.   tagExtraSearch = record
  2301.     guidSearch: TGUID;
  2302.     wszFriendlyName,
  2303.     wszMenuText: array[0..79] of WideChar;
  2304.     wszHelpText: array[0..MAX_PATH] of WideChar;
  2305.     wszUrl: array[0..2047] of WideChar;
  2306.     wszIcon,
  2307.     wszGreyIcon,
  2308.     wszClrIcon: array[0..MAX_PATH+10] of WideChar;
  2309.   end;
  2310.   {$EXTERNALSYM TExtraSearch}
  2311.   TExtraSearch = tagExtraSearch;
  2312.  
  2313.   {$EXTERNALSYM IEnumExtraSearch}
  2314.   IEnumExtraSearch = interface(IUnknown)
  2315.     [SID_IEnumExtraSearch]
  2316.     function Next(celt: ULONG; out rgelt: PExtraSearch;
  2317.       out pceltFetched: ULONG): HResult; stdcall;
  2318.     function Skip(celt: ULONG): HResult; stdcall;
  2319.     function Reset: HResult; stdcall;
  2320.     function Clone(out ppEnum: IEnumExtraSearch): HResult; stdcall;
  2321.   end;
  2322.  
  2323. const
  2324.   {IShellFolder2.GetDefaultColumnState Values}
  2325.   SHCOLSTATE_TYPE_STR     = $00000001;
  2326.   SHCOLSTATE_TYPE_INT     = $00000002;
  2327.   SHCOLSTATE_TYPE_DATE    = $00000003;
  2328.   SHCOLSTATE_TYPEMASK     = $0000000F;
  2329.   SHCOLSTATE_ONBYDEFAULT  = $00000010;   // should on by default in details view
  2330.   SHCOLSTATE_SLOW         = $00000020;   // will be slow to compute; do on a background thread
  2331.   SHCOLSTATE_EXTENDED     = $00000040;   // provided by a handler; not the folder
  2332.   SHCOLSTATE_SECONDARYUI  = $00000080;   // not displayed in context menu; but listed in the "More..." dialog
  2333.   SHCOLSTATE_HIDDEN       = $00000100;   // not displayed in the UI
  2334.  
  2335. type
  2336.   {$EXTERNALSYM PShColumnID}
  2337.   PShColumnID = ^TShColumnID;
  2338.   {$EXTERNALSYM SHCOLUMNID}
  2339.   SHCOLUMNID = record
  2340.     fmtid: TGUID;
  2341.     pid: DWORD;
  2342.   end;
  2343.   {$EXTERNALSYM TShColumnID}
  2344.   TShColumnID = SHCOLUMNID;
  2345.  
  2346.   {$EXTERNALSYM IShellFolder2}
  2347.   IShellFolder2 = interface(IShellFolder)
  2348.     [SID_IShellFolder2]
  2349.     function GetDefaultSearchGUID(out pguid: TGUID): HResult; stdcall;
  2350.     function EnumSearches(out ppEnum: IEnumExtraSearch): HResult; stdcall;
  2351.     function GetDefaultColumn(dwRes: DWORD; var pSort: ULONG;
  2352.       var pDisplay: ULONG): HResult; stdcall;
  2353.     function GetDefaultColumnState(iColumn: UINT; var pcsFlags: DWORD): HResult; stdcall;
  2354.     function GetDetailsEx(pidl: PItemIDList; const pscid: SHCOLUMNID;
  2355.       pv: POleVariant): HResult; stdcall;
  2356.     function GetDetailsOf(pidl: PItemIDList; iColumn: UINT;
  2357.       var psd: TShellDetails): HResult; stdcall;
  2358.     function MapNameToSCID(pwszName: LPCWSTR; var pscid: TShColumnID): HResult; stdcall;
  2359.   end;
  2360.  
  2361. { Helper function which returns a IShellFolder interface to the desktop
  2362.   folder. This is equivalent to call CoCreateInstance with CLSID_ShellDesktop. }
  2363.  
  2364. {$EXTERNALSYM SHGetDesktopFolder}
  2365. function SHGetDesktopFolder(var ppshf: IShellFolder): HResult; stdcall;
  2366.  
  2367. { IInputObjectSite/IInputObject interfaces
  2368.  
  2369.  These interfaces allow us (or ISVs) to install/update external Internet
  2370.  Toolbar for IE and the shell. The frame will simply get the CLSID from
  2371.  registry (to be defined) and CoCreateInstance it. }
  2372.  
  2373. { IInputObjectSite interface }
  2374. {
  2375.  A site implements this interface so the object can communicate
  2376.  focus change to it.
  2377.  
  2378.  [Member functions]
  2379.  
  2380.  IInputObjectSite::OnFocusChangeIS(punkObj, fSetFocus)
  2381.    Object (punkObj) is getting or losing the focus.
  2382. }
  2383. type
  2384.   {$EXTERNALSYM IInputObjectSite}
  2385.   IInputObjectSite = interface(IUnknown)
  2386.     [SID_IInputObjectSite]
  2387.     function OnFocusChangeIS(punkObj: IUnknown; fSetFocus: BOOL): HResult; stdcall;
  2388.   end;
  2389.  
  2390. { IInputObject interface }
  2391. {
  2392.    An object implements this interface so the site can communicate
  2393.  activation and accelerator events to it.
  2394.  
  2395.  [Member functions]
  2396.  
  2397.  IInputObject::UIActivateIO(fActivate, lpMsg)
  2398.    Activates or deactivates the object.  lpMsg may be NULL.  Returns
  2399.    S_OK if the activation succeeded.
  2400.  
  2401.  IInputObject::HasFocusIO()
  2402.    Returns S_OK if the object has the focus, S_FALSE if not.
  2403.  
  2404.  IInputObject::TranslateAcceleratorIO(lpMsg)
  2405.    Allow the object to process the message.  Returns S_OK if the
  2406.    message was processed (eaten).
  2407. }
  2408.   {$EXTERNALSYM IInputObject}
  2409.   IInputObject = interface(IUnknown)
  2410.     [SID_IInputObject]
  2411.     function UIActivateIO(fActivate: BOOL; var lpMsg: TMsg): HResult; stdcall;
  2412.     function HasFocusIO: HResult; stdcall;
  2413.     function TranslateAcceleratorIO(var lpMsg: TMsg): HResult; stdcall;
  2414.   end;
  2415.  
  2416.  
  2417. { ========================================================================== }
  2418. { IDockingWindowSite/IDockingWindow/IDockingWindowFrame interfaces }
  2419. {
  2420.  These interfaces allow us (or ISVs) to install/update external Internet
  2421.  Toolbar for IE and the shell. The frame will simply get the CLSID from
  2422.  registry (to be defined) and CoCreateInstance it.
  2423.  
  2424. { IDockingWindowSite interface }
  2425. {
  2426.   A site implements this interface so the object can negotiate for
  2427.  and inquire about real estate on the site.
  2428.  
  2429.  [Member functions]
  2430.  
  2431.  IDockingWindowSite::GetBorderDW(punkObj, prcBorder)
  2432.    Site returns the bounding rectangle of the given source object
  2433.    (punkObj).
  2434.  
  2435.  IDockingWindowSite::RequestBorderSpaceDW(punkObj, pbw)
  2436.    Object requests that the site makes room for it, as specified in
  2437.    *pbw.
  2438.  
  2439.  IDockingWindowSite::SetBorderSpaceDW(punkObj, pbw)
  2440.    Object requests that the site set the border spacing to the size
  2441.    specified in *pbw.
  2442. }
  2443.   {$EXTERNALSYM IDockingWindowSite}
  2444.   IDockingWindowSite = interface(IOleWindow)
  2445.     [SID_IDockingWindowSite]
  2446.     function GetBorderDW(punkObj: IUnknown; var prcBorder: TRect): HResult; stdcall;
  2447.     function RequestBorderSpaceDW(punkObj: IUnknown; var pbw: TBorderWidths): HResult; stdcall;
  2448.     function SetBorderSpaceDW(punkObj: IUnknown; var pbw: TBorderWidths): HResult; stdcall;
  2449.   end;
  2450.  
  2451. { IDockingWindowFrame interface }
  2452. {
  2453.  [Member functions]
  2454.  
  2455.  IDockingWindowFrame::AddToolbar(punkSrc, pwszItem, dwReserved)
  2456.  
  2457.  IDockingWindowFrame::RemoveToolbar(punkSrc, dwRemoveFlags)
  2458.  
  2459.  IDockingWindowFrame::FindToolbar(pwszItem, riid, ppvObj)
  2460. }
  2461. const
  2462.   // flags for RemoveToolbar
  2463.   {$EXTERNALSYM DWFRF_NORMAL}
  2464.   DWFRF_NORMAL            = $0000;
  2465.   {$EXTERNALSYM DWFRF_DELETECONFIGDATA}
  2466.   DWFRF_DELETECONFIGDATA  = $0001;
  2467.  
  2468.   // flags for AddToolbar
  2469.   {$EXTERNALSYM DWFAF_HIDDEN}
  2470.   DWFAF_HIDDEN            = $0001;   { add hidden }
  2471.  
  2472. type
  2473.   {$EXTERNALSYM IDockingWindowFrame}
  2474.   IDockingWindowFrame = interface(IOleWindow)
  2475.     [SID_IDockingWindowFrame]
  2476.     function AddToolbar(punkSrc: IUnknown; pwszItem: PWideChar;
  2477.       dwAddFlags: DWORD): HResult; stdcall;
  2478.     function RemoveToolbar(punkSrc: IUnknown; dwRemoveFlags: DWORD): HResult; stdcall;
  2479.     function FindToolbar(pwszItem: PWideChar; const riid: TIID;
  2480.       var ppvObj: Pointer): HResult; stdcall;
  2481.   end;
  2482.  
  2483. { IDockingWindow interface }
  2484. {
  2485.  An object (docking window) implements this interface so the site can
  2486.  communicate with it.  An example of a docking window is a toolbar.
  2487.  
  2488.  [Member functions]
  2489.  
  2490.  IDockingWindow::ShowDW(fShow)
  2491.    Shows or hides the docking window.
  2492.  
  2493.  IDockingWindow::CloseDW(dwReserved)
  2494.    Closes the docking window.  dwReserved must be 0.
  2495.  
  2496.  IDockingWindow::ResizeBorderDW(prcBorder, punkToolbarSite, fReserved)
  2497.    Resizes the docking window's border to *prcBorder.  fReserved must
  2498.    be 0.
  2499.  IObjectWithSite::SetSite(punkSite)
  2500.    IDockingWindow usually paired with IObjectWithSite.
  2501.    Provides the IUnknown pointer of the site to the docking window.
  2502. }
  2503.   {$EXTERNALSYM IDockingWindow}
  2504.   IDockingWindow = interface(IOleWindow)
  2505.     [SID_IDockingWindow]
  2506.     function ShowDW(fShow: BOOL): HResult; stdcall;
  2507.     function CloseDW(dwReserved: DWORD): HResult; stdcall;
  2508.     function ResizeBorderDW(var prcBorder: TRect; punkToolbarSite: IUnknown;
  2509.       fReserved: BOOL): HResult; stdcall;
  2510.   end;
  2511.  
  2512. { IDeskBand interface }
  2513. {
  2514.  [Member functions]
  2515.  
  2516.  IDeskBand::GetBandInfo(dwBandID, dwViewMode, pdbi)
  2517.    Returns info on the given band in *pdbi, according to the mask
  2518.    field in the DESKBANDINFO structure and the given viewmode.
  2519. }
  2520. const
  2521.   // Mask values for DESKBANDINFO
  2522.   {$EXTERNALSYM DBIM_MINSIZE}
  2523.   DBIM_MINSIZE    = $0001;
  2524.   {$EXTERNALSYM DBIM_MAXSIZE}
  2525.   DBIM_MAXSIZE    = $0002;
  2526.   {$EXTERNALSYM DBIM_INTEGRAL}
  2527.   DBIM_INTEGRAL   = $0004;
  2528.   {$EXTERNALSYM DBIM_ACTUAL}
  2529.   DBIM_ACTUAL     = $0008;
  2530.   {$EXTERNALSYM DBIM_TITLE}
  2531.   DBIM_TITLE      = $0010;
  2532.   {$EXTERNALSYM DBIM_MODEFLAGS}
  2533.   DBIM_MODEFLAGS  = $0020;
  2534.   {$EXTERNALSYM DBIM_BKCOLOR}
  2535.   DBIM_BKCOLOR    = $0040;
  2536.  
  2537. type
  2538.   {$EXTERNALSYM DESKBANDINFO}
  2539.   DESKBANDINFO = packed record
  2540.     dwMask: DWORD;
  2541.     ptMinSize: TPointL;
  2542.     ptMaxSize: TPointL;
  2543.     ptIntegral: TPointL;
  2544.     ptActual: TPointL;
  2545.     wszTitle: array[0..255] of WideChar;
  2546.     dwModeFlags: DWORD;
  2547.     crBkgnd: COLORREF;
  2548.   end;
  2549.   PDeskBandInfo = ^TDeskBandInfo;
  2550.   TDeskBandInfo = DESKBANDINFO;
  2551.  
  2552. const
  2553.   // DESKBANDINFO dwModeFlags values
  2554.   {$EXTERNALSYM DBIMF_NORMAL}
  2555.   DBIMF_NORMAL            = $0000;
  2556.   {$EXTERNALSYM DBIMF_VARIABLEHEIGHT}
  2557.   DBIMF_VARIABLEHEIGHT    = $0008;
  2558.   {$EXTERNALSYM DBIMF_DEBOSSED}
  2559.   DBIMF_DEBOSSED          = $0020;
  2560.   {$EXTERNALSYM DBIMF_BKCOLOR}
  2561.   DBIMF_BKCOLOR           = $0040;
  2562.  
  2563.   // GetBandInfo view mode values
  2564.   {$EXTERNALSYM DBIF_VIEWMODE_NORMAL}
  2565.   DBIF_VIEWMODE_NORMAL         = $0000;
  2566.   {$EXTERNALSYM DBIF_VIEWMODE_VERTICAL}
  2567.   DBIF_VIEWMODE_VERTICAL       = $0001;
  2568.   {$EXTERNALSYM DBIF_VIEWMODE_FLOATING}
  2569.   DBIF_VIEWMODE_FLOATING       = $0002;
  2570.   {$EXTERNALSYM DBIF_VIEWMODE_TRANSPARENT}
  2571.   DBIF_VIEWMODE_TRANSPARENT    = $0004;
  2572.  
  2573. type
  2574.   {$EXTERNALSYM IDeskBand}
  2575.   IDeskBand = interface(IDockingWindow)
  2576.     [SID_IDeskBand]
  2577.     function GetBandInfo(dwBandID, dwViewMode: DWORD; var pdbi: TDeskBandInfo):
  2578.       HResult; stdcall;
  2579.   end;
  2580.  
  2581. const
  2582.   // Command Target IDs
  2583.   {$EXTERNALSYM DBID_BANDINFOCHANGED}
  2584.   DBID_BANDINFOCHANGED = 0;
  2585.     //  tmp! replace w/ cbs::Select
  2586.   {$EXTERNALSYM DBID_SHOWONLY}
  2587.   DBID_SHOWONLY        = 1;
  2588.   {$EXTERNALSYM DBID_MAXIMIZEBAND}
  2589.   DBID_MAXIMIZEBAND    = 2;  // Maximize the specified band (VT_UI4 == dwID)
  2590.  
  2591. type
  2592.   //  Flags and structures used by IActiveDesktop
  2593.  
  2594.   {$EXTERNALSYM _tagWALLPAPEROPT}
  2595.   _tagWALLPAPEROPT = packed record
  2596.     dwSize: DWORD;     // size of this Structure.
  2597.     dwStyle: DWORD;    // WPSTYLE_* mentioned above
  2598.   end;
  2599.   PWallPaperOpt = ^TWallPaperOpt;
  2600.   {$EXTERNALSYM PWallPaperOpt }
  2601.   TWallPaperOpt = _tagWALLPAPEROPT;
  2602.   {$EXTERNALSYM TWallPaperOpt }
  2603.  
  2604.   {$EXTERNALSYM _tagCOMPONENTSOPT}
  2605.   _tagCOMPONENTSOPT = packed record
  2606.     dwSize: DWORD;             // Size of this structure
  2607.     fEnableComponents: BOOL;   // Enable components?
  2608.     fActiveDesktop: BOOL;      // Active desktop enabled ?
  2609.   end;
  2610.   PComponentsOpt = ^TComponentsOpt;
  2611.   {$EXTERNALSYM PComponentsOpt }
  2612.   TComponentsOpt = _tagCOMPONENTSOPT;
  2613.   {$EXTERNALSYM TComponentsOpt }
  2614.  
  2615.   {$EXTERNALSYM _tagCOMPPOS}
  2616.   _tagCOMPPOS = packed record
  2617.     dwSize: DWORD;             //Size of this structure
  2618.     iLeft: Integer;            //Left of top-left corner in screen co-ordinates.
  2619.     iTop: Integer;             //Top of top-left corner in screen co-ordinates.
  2620.     dwWidth: DWORD;            // Width in pixels.
  2621.     dwHeight: DWORD;           // Height in pixels.
  2622.     izIndex: Integer;          // Indicates the Z-order of the component.
  2623.     fCanResize: BOOL;          // Is the component resizeable?
  2624.     fCanResizeX: BOOL;         // Resizeable in X-direction?
  2625.     fCanResizeY: BOOL;         // Resizeable in Y-direction?
  2626.     iPreferredLeftPercent: Integer;  //Left of top-left corner as percent of screen width
  2627.     iPreferredTopPercent: Integer;   //Top of top-left corner as percent of screen height
  2628.   end;
  2629.   PCompPos = ^TCompPos;
  2630.   {$EXTERNALSYM PCompPos }
  2631.   TCompPos = _tagCOMPPOS;
  2632.   {$EXTERNALSYM TCompPos }
  2633.  
  2634. const
  2635.   {$EXTERNALSYM COMPONENT_TOP}
  2636.   COMPONENT_TOP = $7fffffff;  // izOrder value meaning component is at the top
  2637.  
  2638.   // iCompType values
  2639.   {$EXTERNALSYM COMP_TYPE_HTMLDOC}
  2640.   COMP_TYPE_HTMLDOC       = 0;
  2641.   {$EXTERNALSYM COMP_TYPE_PICTURE}
  2642.   COMP_TYPE_PICTURE       = 1;
  2643.   {$EXTERNALSYM COMP_TYPE_WEBSITE}
  2644.   COMP_TYPE_WEBSITE       = 2;
  2645.   {$EXTERNALSYM COMP_TYPE_CONTROL}
  2646.   COMP_TYPE_CONTROL       = 3;
  2647.   {$EXTERNALSYM COMP_TYPE_CFHTML}
  2648.   COMP_TYPE_CFHTML        = 4;
  2649.   {$EXTERNALSYM COMP_TYPE_MAX}
  2650.   COMP_TYPE_MAX           = 4;
  2651.  
  2652. type
  2653.   {$EXTERNALSYM _tagCOMPONENT}
  2654.   _tagCOMPONENT = packed record
  2655.     dwSize: DWORD;            // Size of this structure
  2656.     dwID: DWORD;              // Reserved: Set it always to zero.
  2657.     iComponentType: Integer;  // One of COMP_TYPE_*
  2658.     fChecked: BOOL;           // Is this component enabled?
  2659.     fDirty: BOOL;             // Had the component been modified and not yet saved to disk?
  2660.     fNoScroll: BOOL;          // Is the component scrollable?
  2661.     cpPos: TCompPos;          // Width, height etc.,
  2662.     wszFriendlyName: array[0..MAX_PATH - 1] of WideChar;  // Friendly name of component.
  2663.     wszSource: array[0..INTERNET_MAX_URL_LENGTH - 1] of WideChar; //URL of the component.
  2664.     wszSubscribedURL: array[0..INTERNET_MAX_URL_LENGTH - 1] of WideChar; //Subscrined URL
  2665.   end;
  2666.   PShComponent = ^TShComponent;
  2667.   {$EXTERNALSYM PShComponent }
  2668.   TShComponent = _tagCOMPONENT;
  2669.   {$EXTERNALSYM TShComponent }
  2670.  
  2671. const
  2672.   // Flags for IActiveDesktop::ApplyChanges()
  2673.   {$EXTERNALSYM AD_APPLY_SAVE}
  2674.   AD_APPLY_SAVE         = $00000001;
  2675.   {$EXTERNALSYM AD_APPLY_HTMLGEN}
  2676.   AD_APPLY_HTMLGEN      = $00000002;
  2677.   {$EXTERNALSYM AD_APPLY_REFRESH}
  2678.   AD_APPLY_REFRESH      = $00000004;
  2679.   {$EXTERNALSYM AD_APPLY_ALL}
  2680.   AD_APPLY_ALL          = AD_APPLY_SAVE or AD_APPLY_HTMLGEN or AD_APPLY_REFRESH;
  2681.   {$EXTERNALSYM AD_APPLY_FORCE}
  2682.   AD_APPLY_FORCE        = $00000008;
  2683.   {$EXTERNALSYM AD_APPLY_BUFFERED_REFRESH}
  2684.   AD_APPLY_BUFFERED_REFRESH = $00000010;
  2685.  
  2686.   // Flags for IActiveDesktop::GetWallpaperOptions()
  2687.   //           IActiveDesktop::SetWallpaperOptions()
  2688.   {$EXTERNALSYM WPSTYLE_CENTER}
  2689.   WPSTYLE_CENTER      = 0;
  2690.   {$EXTERNALSYM WPSTYLE_TILE}
  2691.   WPSTYLE_TILE        = 1;
  2692.   {$EXTERNALSYM WPSTYLE_STRETCH}
  2693.   WPSTYLE_STRETCH     = 2;
  2694.   {$EXTERNALSYM WPSTYLE_MAX}
  2695.   WPSTYLE_MAX         = 3;
  2696.  
  2697.   // Flags for IActiveDesktop::ModifyComponent()
  2698.   {$EXTERNALSYM COMP_ELEM_TYPE}
  2699.   COMP_ELEM_TYPE          = $00000001;
  2700.   {$EXTERNALSYM COMP_ELEM_CHECKED}
  2701.   COMP_ELEM_CHECKED       = $00000002;
  2702.   {$EXTERNALSYM COMP_ELEM_DIRTY}
  2703.   COMP_ELEM_DIRTY         = $00000004;
  2704.   {$EXTERNALSYM COMP_ELEM_NOSCROLL}
  2705.   COMP_ELEM_NOSCROLL      = $00000008;
  2706.   {$EXTERNALSYM COMP_ELEM_POS_LEFT}
  2707.   COMP_ELEM_POS_LEFT      = $00000010;
  2708.   {$EXTERNALSYM COMP_ELEM_POS_TOP}
  2709.   COMP_ELEM_POS_TOP       = $00000020;
  2710.   {$EXTERNALSYM COMP_ELEM_SIZE_WIDTH}
  2711.   COMP_ELEM_SIZE_WIDTH    = $00000040;
  2712.   {$EXTERNALSYM COMP_ELEM_SIZE_HEIGHT}
  2713.   COMP_ELEM_SIZE_HEIGHT   = $00000080;
  2714.   {$EXTERNALSYM COMP_ELEM_POS_ZINDEX}
  2715.   COMP_ELEM_POS_ZINDEX    = $00000100;
  2716.   {$EXTERNALSYM COMP_ELEM_SOURCE}
  2717.   COMP_ELEM_SOURCE        = $00000200;
  2718.   {$EXTERNALSYM COMP_ELEM_FRIENDLYNAME}
  2719.   COMP_ELEM_FRIENDLYNAME  = $00000400;
  2720.   {$EXTERNALSYM COMP_ELEM_SUBSCRIBEDURL}
  2721.   COMP_ELEM_SUBSCRIBEDURL = $00000800;
  2722.  
  2723.   {$EXTERNALSYM COMP_ELEM_ALL}
  2724.   COMP_ELEM_ALL           = COMP_ELEM_TYPE or COMP_ELEM_CHECKED or
  2725.                             COMP_ELEM_DIRTY or COMP_ELEM_NOSCROLL or
  2726.                             COMP_ELEM_POS_LEFT or COMP_ELEM_SIZE_WIDTH  or
  2727.                             COMP_ELEM_SIZE_HEIGHT or COMP_ELEM_POS_ZINDEX or
  2728.                             COMP_ELEM_SOURCE or COMP_ELEM_FRIENDLYNAME;
  2729.  
  2730.   // Flags for IActiveDesktop::AddUrl()
  2731.   {$EXTERNALSYM ADDURL_SILENT}
  2732.   ADDURL_SILENT           = $0001;
  2733.  
  2734. type
  2735.   // Flags for IActiveDesktop::AddDesktopItemWithUI()
  2736.   {$EXTERNALSYM tagDTI_ADTIWUI}
  2737.   tagDTI_ADTIWUI = (DTI_ADDUI_DEFAULT, DTI_ADDUI_DISPSUBWIZARD);
  2738.  
  2739. { Interface for manipulating the Active Desktop. }
  2740.  
  2741.   {$EXTERNALSYM IActiveDesktop}
  2742.   IActiveDesktop = interface(IUnknown)
  2743.     [SID_IActiveDesktop]
  2744.     function ApplyChanges(dwFlags: DWORD): HResult; stdcall;
  2745.     function GetWallpaper(pwszWallpaper: PWideChar; cchWallpaper: UINT;
  2746.       dwReserved: DWORD): HResult; stdcall;
  2747.     function SetWallpaper(pwszWallpaper: PWideChar; dwReserved: DWORD): HResult; stdcall;
  2748.     function GetWallpaperOptions(var pwpo: TWallPaperOpt; dwReserved: DWORD): HResult; stdcall;
  2749.     function SetWallpaperOptions(var pwpo: TWallPaperOpt; dwReserved: DWORD): HResult; stdcall;
  2750.     function GetPattern(pwszPattern: PWideChar; cchPattern: UINT;
  2751.       dwReserved: DWORD): HResult; stdcall;
  2752.     function SetPattern(pwszPattern: PWideChar; dwReserved: DWORD): HResult; stdcall;
  2753.     function GetDesktopItemOptions(var pco: TComponentsOpt; dwReserved: DWORD):
  2754.       HResult; stdcall;
  2755.     function SetDesktopItemOptions(var pco: TComponentsOpt; dwReserved: DWORD):
  2756.       HResult; stdcall;
  2757.     function AddDesktopItem(var pcomp: TShComponent; dwReserved: DWORD): HResult; stdcall;
  2758.     function AddDesktopItemWithUI(hwnd: HWND; var pcomp: TShComponent;
  2759.       dwReserved: DWORD): HResult; stdcall;
  2760.     function ModifyDesktopItem(var pcomp: TShComponent; dwReserved: DWORD): HResult; stdcall;
  2761.     function RemoveDesktopItem(var pcomp: TShComponent; dwReserved: DWORD): HResult; stdcall;
  2762.     function GetDesktopItemCount(var lpiCount: Integer; dwReserved: DWORD): HResult; stdcall;
  2763.     function GetDesktopItem(nComponent: Integer; var pcomp: TShComponent;
  2764.       dwReserved: DWORD): HResult; stdcall;
  2765.     function GetDesktopItemByID(dwID: DWORD; var pcomp: TShComponent;
  2766.       dwReserved: DWORD): HResult; stdcall;
  2767.     function GenerateDesktopItemHtml(pwszFileName: PWideChar;
  2768.       var pcomp: TShComponent; dwReserved: DWORD): HResult; stdcall;
  2769.     function AddUrl(hwnd: HWND; pszSource: PWideChar; var pcomp: TShComponent;
  2770.       dwFlags: DWORD): HResult; stdcall;
  2771.     function GetDesktopItemBySource(pwszSource: PWideChar; var pcomp: TShComponent;
  2772.       dwReserved: DWORD): HResult; stdcall;
  2773.   end;
  2774.  
  2775. const
  2776. { Clipboard format which may be supported by IDataObject from system
  2777.   defined shell folders (such as directories, network, ...). }
  2778.  
  2779.   {$EXTERNALSYM CFSTR_SHELLIDLIST}
  2780.   CFSTR_SHELLIDLIST           = 'Shell IDList Array';     { CF_IDLIST }
  2781.   {$EXTERNALSYM CFSTR_SHELLIDLISTOFFSET}
  2782.   CFSTR_SHELLIDLISTOFFSET     = 'Shell Object Offsets';   { CF_OBJECTPOSITIONS }
  2783.   {$EXTERNALSYM CFSTR_NETRESOURCES}
  2784.   CFSTR_NETRESOURCES          = 'Net Resource';           { CF_NETRESOURCE }
  2785.   {$EXTERNALSYM CFSTR_FILEDESCRIPTORA}
  2786.   CFSTR_FILEDESCRIPTORA       = 'FileGroupDescriptor';    { CF_FILEGROUPDESCRIPTORA }
  2787.   {$EXTERNALSYM CFSTR_FILEDESCRIPTORW}
  2788.   CFSTR_FILEDESCRIPTORW       = 'FileGroupDescriptorW';   { CF_FILEGROUPDESCRIPTORW }
  2789.   {$EXTERNALSYM CFSTR_FILECONTENTS}
  2790.   CFSTR_FILECONTENTS          = 'FileContents';           { CF_FILECONTENTS }
  2791.   {$EXTERNALSYM CFSTR_FILENAMEA}
  2792.   CFSTR_FILENAMEA             = 'FileName';               { CF_FILENAMEA }
  2793.   {$EXTERNALSYM CFSTR_FILENAMEW}
  2794.   CFSTR_FILENAMEW             = 'FileNameW';              { CF_FILENAMEW }
  2795.   {$EXTERNALSYM CFSTR_PRINTERGROUP}
  2796.   CFSTR_PRINTERGROUP          = 'PrinterFriendlyName';    { CF_PRINTERS }
  2797.   {$EXTERNALSYM CFSTR_FILENAMEMAPA}
  2798.   CFSTR_FILENAMEMAPA          = 'FileNameMap';            { CF_FILENAMEMAPA }
  2799.   {$EXTERNALSYM CFSTR_FILENAMEMAPW}
  2800.   CFSTR_FILENAMEMAPW          = 'FileNameMapW';           { CF_FILENAMEMAPW }
  2801.   {$EXTERNALSYM CFSTR_SHELLURL}
  2802.   CFSTR_SHELLURL              = 'UniformResourceLocator';
  2803.   {$EXTERNALSYM CFSTR_PREFERREDDROPEFFECT}
  2804.   CFSTR_PREFERREDDROPEFFECT   = 'Preferred DropEffect';
  2805.   {$EXTERNALSYM CFSTR_PERFORMEDDROPEFFECT}
  2806.   CFSTR_PERFORMEDDROPEFFECT   = 'Performed DropEffect';
  2807.   {$EXTERNALSYM CFSTR_PASTESUCCEEDED}
  2808.   CFSTR_PASTESUCCEEDED        = 'Paste Succeeded';
  2809.   {$EXTERNALSYM CFSTR_INDRAGLOOP}
  2810.   CFSTR_INDRAGLOOP            = 'InShellDragLoop';
  2811.  
  2812.  
  2813.  
  2814.  
  2815.  
  2816.  
  2817.  
  2818.  
  2819.  
  2820.   {$EXTERNALSYM CFSTR_FILEDESCRIPTOR}
  2821.   CFSTR_FILEDESCRIPTOR        = CFSTR_FILEDESCRIPTORA;
  2822.   {$EXTERNALSYM CFSTR_FILENAME}
  2823.   CFSTR_FILENAME              = CFSTR_FILENAMEA;
  2824.   {$EXTERNALSYM CFSTR_FILENAMEMAP}
  2825.   CFSTR_FILENAMEMAP           = CFSTR_FILENAMEMAPA;
  2826.  
  2827.  
  2828.  
  2829. { CF_OBJECTPOSITIONS }
  2830.  
  2831.   {$EXTERNALSYM DVASPECT_SHORTNAME}
  2832.   DVASPECT_SHORTNAME     = 2; { use for CF_HDROP to get short name version }
  2833.  
  2834.  
  2835. type
  2836. { format of CF_NETRESOURCE }
  2837.  
  2838.   PNResArray = ^TNResArray;
  2839.   {$EXTERNALSYM _NRESARRAY}
  2840.   _NRESARRAY = record
  2841.     cItems: UINT;
  2842.     nr: array[0..0] of TNetResource;
  2843.   end;
  2844.   TNResArray = _NRESARRAY;
  2845.   {$EXTERNALSYM NRESARRAY}
  2846.   NRESARRAY = _NRESARRAY;
  2847.  
  2848.  
  2849. { format of CF_IDLIST }
  2850.  
  2851.   PIDA = ^TIDA;
  2852.   {$EXTERNALSYM _IDA}
  2853.   _IDA = record
  2854.     cidl: UINT;                      { number of relative IDList }
  2855.     aoffset: array[0..0] of UINT;    { [0]: folder IDList, [1]-[cidl]: item IDList }
  2856.   end;
  2857.   TIDA = _IDA;
  2858.   {$EXTERNALSYM CIDA}
  2859.   CIDA = _IDA;
  2860.  
  2861.  
  2862.  
  2863. const
  2864. { FILEDESCRIPTOR.dwFlags field indicate which fields are to be used }
  2865.  
  2866.   {$EXTERNALSYM FD_CLSID}
  2867.   FD_CLSID            = $0001;
  2868.   {$EXTERNALSYM FD_SIZEPOINT}
  2869.   FD_SIZEPOINT        = $0002;
  2870.   {$EXTERNALSYM FD_ATTRIBUTES}
  2871.   FD_ATTRIBUTES       = $0004;
  2872.   {$EXTERNALSYM FD_CREATETIME}
  2873.   FD_CREATETIME       = $0008;
  2874.   {$EXTERNALSYM FD_ACCESSTIME}
  2875.   FD_ACCESSTIME       = $0010;
  2876.   {$EXTERNALSYM FD_WRITESTIME}
  2877.   FD_WRITESTIME       = $0020;
  2878.   {$EXTERNALSYM FD_FILESIZE}
  2879.   FD_FILESIZE         = $0040;
  2880.   {$EXTERNALSYM FD_LINKUI}
  2881.   FD_LINKUI           = $8000;       { 'link' UI is prefered }
  2882.  
  2883. type
  2884.   PFileDescriptorA = ^TFileDescriptorA;
  2885.   PFileDescriptorW = ^TFileDescriptorW;
  2886.   PFileDescriptor = PFileDescriptorA;
  2887.   {$EXTERNALSYM _FILEDESCRIPTORA}
  2888.   _FILEDESCRIPTORA = record
  2889.     dwFlags: DWORD;
  2890.     clsid: TCLSID;
  2891.     sizel: TSize;
  2892.     pointl: TPoint;
  2893.     dwFileAttributes: DWORD;
  2894.     ftCreationTime: TFileTime;
  2895.     ftLastAccessTime: TFileTime;
  2896.     ftLastWriteTime: TFileTime;
  2897.     nFileSizeHigh: DWORD;
  2898.     nFileSizeLow: DWORD;
  2899.     cFileName: array[0..MAX_PATH-1] of AnsiChar;
  2900.   end;
  2901.   {$EXTERNALSYM _FILEDESCRIPTORW}
  2902.   _FILEDESCRIPTORW = record
  2903.     dwFlags: DWORD;
  2904.     clsid: TCLSID;
  2905.     sizel: TSize;
  2906.     pointl: TPoint;
  2907.     dwFileAttributes: DWORD;
  2908.     ftCreationTime: TFileTime;
  2909.     ftLastAccessTime: TFileTime;
  2910.     ftLastWriteTime: TFileTime;
  2911.     nFileSizeHigh: DWORD;
  2912.     nFileSizeLow: DWORD;
  2913.     cFileName: array[0..MAX_PATH-1] of WideChar;
  2914.   end;
  2915.   {$EXTERNALSYM _FILEDESCRIPTOR}
  2916.   _FILEDESCRIPTOR = _FILEDESCRIPTORA;
  2917.   TFileDescriptorA = _FILEDESCRIPTORA;
  2918.   TFileDescriptorW = _FILEDESCRIPTORW;
  2919.   TFileDescriptor = TFileDescriptorA;
  2920.   {$EXTERNALSYM FILEDESCRIPTORA}
  2921.   FILEDESCRIPTORA = _FILEDESCRIPTORA;
  2922.   {$EXTERNALSYM FILEDESCRIPTORW}
  2923.   FILEDESCRIPTORW = _FILEDESCRIPTORW;
  2924.   {$EXTERNALSYM FILEDESCRIPTOR}
  2925.   FILEDESCRIPTOR = FILEDESCRIPTORA;
  2926.  
  2927. { format of CF_FILEGROUPDESCRIPTOR }
  2928.  
  2929.   PFileGroupDescriptorA = ^TFileGroupDescriptorA;
  2930.   PFileGroupDescriptorW = ^TFileGroupDescriptorW;
  2931.   PFileGroupDescriptor = PFileGroupDescriptorA;
  2932.   {$EXTERNALSYM _FILEGROUPDESCRIPTORA}
  2933.   _FILEGROUPDESCRIPTORA = record
  2934.     cItems: UINT;
  2935.     fgd: array[0..0] of TFileDescriptor;
  2936.   end;
  2937.   {$EXTERNALSYM _FILEGROUPDESCRIPTORW}
  2938.   _FILEGROUPDESCRIPTORW = record
  2939.     cItems: UINT;
  2940.     fgd: array[0..0] of TFileDescriptor;
  2941.   end;
  2942.   {$EXTERNALSYM _FILEGROUPDESCRIPTOR}
  2943.   _FILEGROUPDESCRIPTOR = _FILEGROUPDESCRIPTORA;
  2944.   TFileGroupDescriptorA = _FILEGROUPDESCRIPTORA;
  2945.   TFileGroupDescriptorW = _FILEGROUPDESCRIPTORW;
  2946.   TFileGroupDescriptor = TFileGroupDescriptorA;
  2947.   {$EXTERNALSYM FILEGROUPDESCRIPTORA}
  2948.   FILEGROUPDESCRIPTORA = _FILEGROUPDESCRIPTORA;
  2949.   {$EXTERNALSYM FILEGROUPDESCRIPTORW}
  2950.   FILEGROUPDESCRIPTORW = _FILEGROUPDESCRIPTORW;
  2951.   {$EXTERNALSYM FILEGROUPDESCRIPTOR}
  2952.   FILEGROUPDESCRIPTOR = FILEGROUPDESCRIPTORA;
  2953.  
  2954. { format of CF_HDROP and CF_PRINTERS, in the HDROP case the data that follows
  2955.   is a double null terinated list of file names, for printers they are printer
  2956.   friendly names }
  2957.  
  2958.   PDropFiles = ^TDropFiles;
  2959.   {$EXTERNALSYM _DROPFILES}
  2960.   _DROPFILES = record
  2961.     pFiles: DWORD;                       { offset of file list }
  2962.     pt: TPoint;                          { drop point (client coords) }
  2963.     fNC: BOOL;                           { is it on NonClient area }
  2964.                                          { and pt is in screen coords }
  2965.     fWide: BOOL;                         { WIDE character switch }
  2966.   end;
  2967.   TDropFiles = _DROPFILES;
  2968.   {$EXTERNALSYM DROPFILES}
  2969.   DROPFILES = _DROPFILES;
  2970.  
  2971.  
  2972. { File System Notification APIs }
  2973.  
  2974. const
  2975. { File System Notification flags }
  2976.  
  2977.   {$EXTERNALSYM SHCNE_RENAMEITEM}
  2978.   SHCNE_RENAMEITEM          = $00000001;
  2979.   {$EXTERNALSYM SHCNE_CREATE}
  2980.   SHCNE_CREATE              = $00000002;
  2981.   {$EXTERNALSYM SHCNE_DELETE}
  2982.   SHCNE_DELETE              = $00000004;
  2983.   {$EXTERNALSYM SHCNE_MKDIR}
  2984.   SHCNE_MKDIR               = $00000008;
  2985.   {$EXTERNALSYM SHCNE_RMDIR}
  2986.   SHCNE_RMDIR               = $00000010;
  2987.   {$EXTERNALSYM SHCNE_MEDIAINSERTED}
  2988.   SHCNE_MEDIAINSERTED       = $00000020;
  2989.   {$EXTERNALSYM SHCNE_MEDIAREMOVED}
  2990.   SHCNE_MEDIAREMOVED        = $00000040;
  2991.   {$EXTERNALSYM SHCNE_DRIVEREMOVED}
  2992.   SHCNE_DRIVEREMOVED        = $00000080;
  2993.   {$EXTERNALSYM SHCNE_DRIVEADD}
  2994.   SHCNE_DRIVEADD            = $00000100;
  2995.   {$EXTERNALSYM SHCNE_NETSHARE}
  2996.   SHCNE_NETSHARE            = $00000200;
  2997.   {$EXTERNALSYM SHCNE_NETUNSHARE}
  2998.   SHCNE_NETUNSHARE          = $00000400;
  2999.   {$EXTERNALSYM SHCNE_ATTRIBUTES}
  3000.   SHCNE_ATTRIBUTES          = $00000800;
  3001.   {$EXTERNALSYM SHCNE_UPDATEDIR}
  3002.   SHCNE_UPDATEDIR           = $00001000;
  3003.   {$EXTERNALSYM SHCNE_UPDATEITEM}
  3004.   SHCNE_UPDATEITEM          = $00002000;
  3005.   {$EXTERNALSYM SHCNE_SERVERDISCONNECT}
  3006.   SHCNE_SERVERDISCONNECT    = $00004000;
  3007.   {$EXTERNALSYM SHCNE_UPDATEIMAGE}
  3008.   SHCNE_UPDATEIMAGE         = $00008000;
  3009.   {$EXTERNALSYM SHCNE_DRIVEADDGUI}
  3010.   SHCNE_DRIVEADDGUI         = $00010000;
  3011.   {$EXTERNALSYM SHCNE_RENAMEFOLDER}
  3012.   SHCNE_RENAMEFOLDER        = $00020000;
  3013.   {$EXTERNALSYM SHCNE_FREESPACE}
  3014.   SHCNE_FREESPACE           = $00040000;
  3015.   {$EXTERNALSYM SHCNE_EXTENDED_EVENT}
  3016.   SHCNE_EXTENDED_EVENT      = $04000000;
  3017.   SHCNE_EXTENDED_EVENT_PRE_IE4 = $00080000;
  3018.  
  3019.   {$EXTERNALSYM SHCNE_ASSOCCHANGED}
  3020.   SHCNE_ASSOCCHANGED        = $08000000;
  3021.  
  3022.   {$EXTERNALSYM SHCNE_DISKEVENTS}
  3023.   SHCNE_DISKEVENTS          = $0002381F;
  3024.   {$EXTERNALSYM SHCNE_GLOBALEVENTS}
  3025.   SHCNE_GLOBALEVENTS        = $0C0581E0; { Events that dont match pidls first }
  3026.   {$EXTERNALSYM SHCNE_ALLEVENTS}
  3027.   SHCNE_ALLEVENTS           = $7FFFFFFF;
  3028.   {$EXTERNALSYM SHCNE_INTERRUPT}
  3029.   SHCNE_INTERRUPT           = $80000000; { The presence of this flag indicates }
  3030.                                          { that the event was generated by an }
  3031.                                          { interrupt.  It is stripped out before }
  3032.                                          { the clients of SHCNNotify_ see it. }
  3033.   {$EXTERNALSYM SHCNEE_THEMECHANGED}
  3034.   SHCNEE_THEMECHANGED       = $00000001;
  3035.   {$EXTERNALSYM SHCNEE_ORDERCHANGED}
  3036.   SHCNEE_ORDERCHANGED       = $00000002; { dwItem2 is the pidl of the changed folder }
  3037.  
  3038.  
  3039. { uFlags & SHCNF_TYPE is an ID which indicates what dwItem1 and dwItem2 mean }
  3040.  
  3041.   {$EXTERNALSYM SHCNF_IDLIST}
  3042.   SHCNF_IDLIST          = $0000;        { LPITEMIDLIST }
  3043.   {$EXTERNALSYM SHCNF_PATHA}
  3044.   SHCNF_PATHA           = $0001;        { path name }
  3045.   {$EXTERNALSYM SHCNF_PRINTERA}
  3046.   SHCNF_PRINTERA        = $0002;        { printer friendly name }
  3047.   {$EXTERNALSYM SHCNF_DWORD}
  3048.   SHCNF_DWORD           = $0003;        { DWORD }
  3049.   {$EXTERNALSYM SHCNF_PATHW}
  3050.   SHCNF_PATHW           = $0005;        { path name }
  3051.   {$EXTERNALSYM SHCNF_PRINTERW}
  3052.   SHCNF_PRINTERW        = $0006;        { printer friendly name }
  3053.   {$EXTERNALSYM SHCNF_TYPE}
  3054.   SHCNF_TYPE            = $00FF;
  3055.   {$EXTERNALSYM SHCNF_FLUSH}
  3056.   SHCNF_FLUSH           = $1000;
  3057.   {$EXTERNALSYM SHCNF_FLUSHNOWAIT}
  3058.   SHCNF_FLUSHNOWAIT     = $2000;
  3059.  
  3060.  
  3061.  
  3062.  
  3063.  
  3064.  
  3065.  
  3066.   {$EXTERNALSYM SHCNF_PATH}
  3067.   SHCNF_PATH          = SHCNF_PATHA;
  3068.   {$EXTERNALSYM SHCNF_PRINTER}
  3069.   SHCNF_PRINTER       = SHCNF_PRINTERA;
  3070.  
  3071.  
  3072. { APIs }
  3073.  
  3074. {$EXTERNALSYM SHChangeNotify}
  3075. procedure SHChangeNotify(wEventId: Longint; uFlags: UINT;
  3076.   dwItem1, dwItem2: Pointer); stdcall;
  3077.  
  3078. { IShellChangeNotify }
  3079.  
  3080. type
  3081.   {$EXTERNALSYM IShellChangeNotify}
  3082.   IShellChangeNotify = interface(IUnknown)
  3083.     [SID_IShellChangeNotify]
  3084.     function OnChange(lEvent: Longint; var pidl1, pidl2: TItemIDList): HResult; stdcall;
  3085.   end;
  3086.  
  3087. { IQueryInfo }
  3088.  
  3089.   {$EXTERNALSYM IQueryInfo}
  3090.   IQueryInfo = interface(IUnknown)
  3091.     [SID_IQueryInfo]
  3092.     function GetInfoTip(dwFlags: DWORD; var ppwszTip: PWideChar): HResult; stdcall;
  3093.     function GetInfoFlags(out pdwFlags: DWORD): HResult; stdcall;
  3094.   end;
  3095.  
  3096. const
  3097.   {$EXTERNALSYM QIF_CACHED}
  3098.   QIF_CACHED           = $00000001;
  3099.   {$EXTERNALSYM QIF_DONTEXPANDFOLDER}
  3100.   QIF_DONTEXPANDFOLDER = $00000002;
  3101.  
  3102. {$EXTERNALSYM SHAddToRecentDocs}
  3103. procedure SHAddToRecentDocs(uFlags: UINT; pv: Pointer); stdcall;
  3104. {$EXTERNALSYM SHGetInstanceExplorer}
  3105. function SHGetInstanceExplorer(var ppUnk: IUnknown): HResult; stdcall;
  3106.  
  3107. { SHAddToRecentDocs }
  3108.  
  3109. const
  3110.   {$EXTERNALSYM SHARD_PIDL}
  3111.   SHARD_PIDL          = $00000001;
  3112.   {$EXTERNALSYM SHARD_PATHA}
  3113.   SHARD_PATHA         = $00000002;
  3114.   {$EXTERNALSYM SHARD_PATHW}
  3115.   SHARD_PATHW         = $00000003;
  3116.  
  3117.  
  3118.  
  3119.  
  3120.  
  3121.   {$EXTERNALSYM SHARD_PATH}
  3122.   SHARD_PATH      = SHARD_PATHA;
  3123.  
  3124.  
  3125.  
  3126. { SHGetDataFromIDList}
  3127.  
  3128. const
  3129.   {$EXTERNALSYM SHGDFIL_FINDDATA}
  3130.   SHGDFIL_FINDDATA            = 1;
  3131.   {$EXTERNALSYM SHGDFIL_NETRESOURCE}
  3132.   SHGDFIL_NETRESOURCE         = 2;
  3133.   {$EXTERNALSYM SHGDFIL_DESCRIPTIONID}
  3134.   SHGDFIL_DESCRIPTIONID       = 3;
  3135.  
  3136.   {$EXTERNALSYM SHDID_ROOT_REGITEM}
  3137.   SHDID_ROOT_REGITEM              = 1;
  3138.   {$EXTERNALSYM SHDID_FS_FILE}
  3139.   SHDID_FS_FILE                   = 2;
  3140.   {$EXTERNALSYM SHDID_FS_DIRECTORY}
  3141.   SHDID_FS_DIRECTORY              = 3;
  3142.   {$EXTERNALSYM SHDID_FS_OTHER}
  3143.   SHDID_FS_OTHER                  = 4;
  3144.   {$EXTERNALSYM SHDID_COMPUTER_DRIVE35}
  3145.   SHDID_COMPUTER_DRIVE35          = 5;
  3146.   {$EXTERNALSYM SHDID_COMPUTER_DRIVE525}
  3147.   SHDID_COMPUTER_DRIVE525         = 6;
  3148.   {$EXTERNALSYM SHDID_COMPUTER_REMOVABLE}
  3149.   SHDID_COMPUTER_REMOVABLE        = 7;
  3150.   {$EXTERNALSYM SHDID_COMPUTER_FIXED}
  3151.   SHDID_COMPUTER_FIXED            = 8;
  3152.   {$EXTERNALSYM SHDID_COMPUTER_NETDRIVE}
  3153.   SHDID_COMPUTER_NETDRIVE         = 9;
  3154.   {$EXTERNALSYM SHDID_COMPUTER_CDROM}
  3155.   SHDID_COMPUTER_CDROM            = 10;
  3156.   {$EXTERNALSYM SHDID_COMPUTER_RAMDISK}
  3157.   SHDID_COMPUTER_RAMDISK          = 11;
  3158.   {$EXTERNALSYM SHDID_COMPUTER_OTHER}
  3159.   SHDID_COMPUTER_OTHER            = 12;
  3160.   {$EXTERNALSYM SHDID_NET_DOMAIN}
  3161.   SHDID_NET_DOMAIN                = 13;
  3162.   {$EXTERNALSYM SHDID_NET_SERVER}
  3163.   SHDID_NET_SERVER                = 14;
  3164.   {$EXTERNALSYM SHDID_NET_SHARE}
  3165.   SHDID_NET_SHARE                 = 15;
  3166.   {$EXTERNALSYM SHDID_NET_RESTOFNET}
  3167.   SHDID_NET_RESTOFNET             = 16;
  3168.   {$EXTERNALSYM SHDID_NET_OTHER}
  3169.   SHDID_NET_OTHER                 = 17;
  3170.  
  3171. type
  3172.   PSHDescriptionID = ^TSHDescriptionID;
  3173.   {$EXTERNALSYM _SHDESCRIPTIONID}
  3174.   _SHDESCRIPTIONID = record
  3175.     dwDescriptionId: DWORD;
  3176.     Id: TCLSID;
  3177.   end;
  3178.   TSHDescriptionID = _SHDESCRIPTIONID;
  3179.   {$EXTERNALSYM SHDESCRIPTIONID}
  3180.   SHDESCRIPTIONID = _SHDESCRIPTIONID;
  3181.  
  3182.  
  3183. {$EXTERNALSYM SHGetDataFromIDList}
  3184. function SHGetDataFromIDList(psf: IShellFolder; pidl: PItemIDList;
  3185.   nFormat: Integer; ptr: Pointer; cb: Integer): HResult; stdcall;
  3186. {$EXTERNALSYM SHGetDataFromIDListA}
  3187. function SHGetDataFromIDListA(psf: IShellFolder; pidl: PItemIDList;
  3188.   nFormat: Integer; ptr: Pointer; cb: Integer): HResult; stdcall;
  3189. {$EXTERNALSYM SHGetDataFromIDListW}
  3190. function SHGetDataFromIDListW(psf: IShellFolder; pidl: PItemIDList;
  3191.   nFormat: Integer; ptr: Pointer; cb: Integer): HResult; stdcall;
  3192.  
  3193. { PROPIDs for Internet Shortcuts (FMTID_Intshcut) to be used with }
  3194. { IPropertySetStorage/IPropertyStorage }
  3195. {
  3196.  The known property ids and their variant types are:
  3197.       PID_IS_URL          [VT_LPWSTR]   URL
  3198.       PID_IS_NAME         [VT_LPWSTR]   Name of the internet shortcut
  3199.       PID_IS_WORKINGDIR   [VT_LPWSTR]   Working directory for the shortcut
  3200.       PID_IS_HOTKEY       [VT_UI2]      Hotkey for the shortcut
  3201.       PID_IS_SHOWCMD      [VT_I4]       Show command for shortcut
  3202.       PID_IS_ICONINDEX    [VT_I4]       Index into file that has icon
  3203.       PID_IS_ICONFILE     [VT_LPWSTR]   File that has the icon
  3204.       PID_IS_WHATSNEW     [VT_LPWSTR]   What's New text
  3205.       PID_IS_AUTHOR       [VT_LPWSTR]   Author
  3206.       PID_IS_DESCRIPTION  [VT_LPWSTR]   Description text of site
  3207.       PID_IS_COMMENT      [VT_LPWSTR]   User annotated comment
  3208. }
  3209.  
  3210. const
  3211.   {$EXTERNALSYM PID_IS_URL}
  3212.   PID_IS_URL           = 2;
  3213.   {$EXTERNALSYM PID_IS_NAME}
  3214.   PID_IS_NAME          = 4;
  3215.   {$EXTERNALSYM PID_IS_WORKINGDIR}
  3216.   PID_IS_WORKINGDIR    = 5;
  3217.   {$EXTERNALSYM PID_IS_HOTKEY}
  3218.   PID_IS_HOTKEY        = 6;
  3219.   {$EXTERNALSYM PID_IS_SHOWCMD}
  3220.   PID_IS_SHOWCMD       = 7;
  3221.   {$EXTERNALSYM PID_IS_ICONINDEX}
  3222.   PID_IS_ICONINDEX     = 8;
  3223.   {$EXTERNALSYM PID_IS_ICONFILE}
  3224.   PID_IS_ICONFILE      = 9;
  3225.   {$EXTERNALSYM PID_IS_WHATSNEW}
  3226.   PID_IS_WHATSNEW      = 10;
  3227.   {$EXTERNALSYM PID_IS_AUTHOR}
  3228.   PID_IS_AUTHOR        = 11;
  3229.   {$EXTERNALSYM PID_IS_DESCRIPTION}
  3230.   PID_IS_DESCRIPTION   = 12;
  3231.   {$EXTERNALSYM PID_IS_COMMENT}
  3232.   PID_IS_COMMENT       = 13;
  3233.  
  3234. { PROPIDs for Internet Sites (FMTID_InternetSite) to be used with }
  3235. { IPropertySetStorage/IPropertyStorage }
  3236. {
  3237.  The known property ids and their variant types are:
  3238.       PID_INTSITE_WHATSNEW     [VT_LPWSTR]   What's New text
  3239.       PID_INTSITE_AUTHOR       [VT_LPWSTR]   Author
  3240.       PID_INTSITE_LASTVISIT    [VT_FILETIME] Time site was last visited
  3241.       PID_INTSITE_LASTMOD      [VT_FILETIME] Time site was last modified
  3242.       PID_INTSITE_VISITCOUNT   [VT_UI4]      Number of times user has visited
  3243.       PID_INTSITE_DESCRIPTION  [VT_LPWSTR]   Description text of site
  3244.       PID_INTSITE_COMMENT      [VT_LPWSTR]   User annotated comment
  3245.       PID_INTSITE_RECURSE      [VT_UI4]      Levels to recurse (0-3)
  3246.       PID_INTSITE_WATCH        [VT_UI4]      PIDISM_ flags
  3247.       PID_INTSITE_SUBSCRIPTION [VT_UI8]      Subscription cookie
  3248.       PID_INTSITE_URL          [VT_LPWSTR]   URL
  3249.       PID_INTSITE_TITLE        [VT_LPWSTR]   Title
  3250.       PID_INTSITE_CODEPAGE     [VT_UI4]      Codepage of the document
  3251.       PID_INTSITE_TRACKING     [VT_UI4]      Tracking
  3252. }
  3253.  
  3254.   {$EXTERNALSYM PID_INTSITE_WHATSNEW}
  3255.   PID_INTSITE_WHATSNEW      = 2;
  3256.   {$EXTERNALSYM PID_INTSITE_AUTHOR}
  3257.   PID_INTSITE_AUTHOR        = 3;
  3258.   {$EXTERNALSYM PID_INTSITE_LASTVISIT}
  3259.   PID_INTSITE_LASTVISIT     = 4;
  3260.   {$EXTERNALSYM PID_INTSITE_LASTMOD}
  3261.   PID_INTSITE_LASTMOD       = 5;
  3262.   {$EXTERNALSYM PID_INTSITE_VISITCOUNT}
  3263.   PID_INTSITE_VISITCOUNT    = 6;
  3264.   {$EXTERNALSYM PID_INTSITE_DESCRIPTION}
  3265.   PID_INTSITE_DESCRIPTION   = 7;
  3266.   {$EXTERNALSYM PID_INTSITE_COMMENT}
  3267.   PID_INTSITE_COMMENT       = 8;
  3268.   {$EXTERNALSYM PID_INTSITE_FLAGS}
  3269.   PID_INTSITE_FLAGS         = 9;
  3270.   {$EXTERNALSYM PID_INTSITE_CONTENTLEN}
  3271.   PID_INTSITE_CONTENTLEN    = 10;
  3272.   {$EXTERNALSYM PID_INTSITE_CONTENTCODE}
  3273.   PID_INTSITE_CONTENTCODE   = 11;
  3274.   {$EXTERNALSYM PID_INTSITE_RECURSE}
  3275.   PID_INTSITE_RECURSE       = 12;
  3276.   {$EXTERNALSYM PID_INTSITE_WATCH}
  3277.   PID_INTSITE_WATCH         = 13;
  3278.   {$EXTERNALSYM PID_INTSITE_SUBSCRIPTION}
  3279.   PID_INTSITE_SUBSCRIPTION  = 14;
  3280.   {$EXTERNALSYM PID_INTSITE_URL}
  3281.   PID_INTSITE_URL           = 15;
  3282.   {$EXTERNALSYM PID_INTSITE_TITLE}
  3283.   PID_INTSITE_TITLE         = 16;
  3284.   {$EXTERNALSYM PID_INTSITE_CODEPAGE}
  3285.   PID_INTSITE_CODEPAGE      = 18;
  3286.   {$EXTERNALSYM PID_INTSITE_TRACKING}
  3287.   PID_INTSITE_TRACKING      = 19;
  3288.  
  3289.   // Flags for PID_IS_FLAGS
  3290.   {$EXTERNALSYM PIDISF_RECENTLYCHANGED}
  3291.   PIDISF_RECENTLYCHANGED  = $00000001;
  3292.   {$EXTERNALSYM PIDISF_CACHEDSTICKY}
  3293.   PIDISF_CACHEDSTICKY     = $00000002;
  3294.   {$EXTERNALSYM PIDISF_CACHEIMAGES}
  3295.   PIDISF_CACHEIMAGES      = $00000010;
  3296.   {$EXTERNALSYM PIDISF_FOLLOWALLLINKS}
  3297.   PIDISF_FOLLOWALLLINKS   = $00000020;
  3298.  
  3299.   // Values for PID_INTSITE_WATCH
  3300.   {$EXTERNALSYM PIDISM_GLOBAL}
  3301.   PIDISM_GLOBAL           = 0;       // Monitor based on global setting
  3302.   {$EXTERNALSYM PIDISM_WATCH}
  3303.   PIDISM_WATCH            = 1;       // User says watch
  3304.   {$EXTERNALSYM PIDISM_DONTWATCH}
  3305.   PIDISM_DONTWATCH        = 2;       // User says don't watch
  3306.  
  3307. { The shell keeps track of some per-user state to handle display
  3308.   options that is of major interest to ISVs.
  3309.   The key one requested right now is "DoubleClickInWebView". }
  3310.  
  3311. type
  3312.   {$EXTERNALSYM SHELLFLAGSTATE}
  3313.   SHELLFLAGSTATE = packed record
  3314.     Data: Word;
  3315. {   BOOL fShowAllObjects : 1;
  3316.     BOOL fShowExtensions : 1;
  3317.     BOOL fNoConfirmRecycle : 1;
  3318.     BOOL fShowSysFiles : 1;
  3319.     BOOL fShowCompColor : 1;
  3320.     BOOL fDoubleClickInWebView : 1;
  3321.     BOOL fDesktopHTML : 1;
  3322.     BOOL fWin95Classic : 1;
  3323.     BOOL fDontPrettyPath : 1;
  3324.     BOOL fShowAttribCol : 1;
  3325.     BOOL fMapNetDrvBtn : 1;
  3326.     BOOL fShowInfoTip : 1;
  3327.     BOOL fHideIcons : 1;
  3328.     UINT fRestFlags : 3;}
  3329.   end;
  3330.   PShellFlagState = ^TShellFlagState;
  3331.   TShellFlagState = SHELLFLAGSTATE;
  3332.  
  3333. const
  3334.   {$EXTERNALSYM SSF_SHOWALLOBJECTS}
  3335.   SSF_SHOWALLOBJECTS          = $0001;
  3336.   {$EXTERNALSYM SSF_SHOWEXTENSIONS}
  3337.   SSF_SHOWEXTENSIONS          = $0002;
  3338.   {$EXTERNALSYM SSF_SHOWCOMPCOLOR}
  3339.   SSF_SHOWCOMPCOLOR           = $0008;
  3340.   {$EXTERNALSYM SSF_SHOWSYSFILES}
  3341.   SSF_SHOWSYSFILES            = $0020;
  3342.   {$EXTERNALSYM SSF_DOUBLECLICKINWEBVIEW}
  3343.   SSF_DOUBLECLICKINWEBVIEW    = $0080;
  3344.   {$EXTERNALSYM SSF_SHOWATTRIBCOL}
  3345.   SSF_SHOWATTRIBCOL           = $0100;
  3346.   {$EXTERNALSYM SSF_DESKTOPHTML}
  3347.   SSF_DESKTOPHTML             = $0200;
  3348.   {$EXTERNALSYM SSF_WIN95CLASSIC}
  3349.   SSF_WIN95CLASSIC            = $0400;
  3350.   {$EXTERNALSYM SSF_DONTPRETTYPATH}
  3351.   SSF_DONTPRETTYPATH          = $0800;
  3352.   {$EXTERNALSYM SSF_SHOWINFOTIP}
  3353.   SSF_SHOWINFOTIP             = $2000;
  3354.   {$EXTERNALSYM SSF_MAPNETDRVBUTTON}
  3355.   SSF_MAPNETDRVBUTTON         = $1000;
  3356.   {$EXTERNALSYM SSF_NOCONFIRMRECYCLE}
  3357.   SSF_NOCONFIRMRECYCLE        = $8000;
  3358.   {$EXTERNALSYM SSF_HIDEICONS}
  3359.   SSF_HIDEICONS               = $4000;
  3360.  
  3361. { Specify the bits you are interested in in dwMask and they will be
  3362.  filled out in the lpss structure.
  3363.  
  3364.  When these settings change, a WM_SETTINGCHANGE message is sent
  3365.  with the string lParam value of "ShellState". }
  3366.  
  3367. procedure SHGetSettings(var lpss: TShellFlagState; dwMask: DWORD); stdcall;
  3368. {$EXTERNALSYM SHGetSettings}
  3369.  
  3370. { SoftwareUpdateMessageBox }
  3371. {
  3372.     Provides a standard message box for the alerting the user that a software
  3373.     update is available or installed. No UI will be displayed if there is no
  3374.     update available or if the available update version is less than or equal
  3375.     to the Advertised update version.
  3376.  
  3377.     hWnd                - [in] Handle of owner window
  3378.     szDistUnit          - [in] Unique identifier string for a code distribution unit. For
  3379.                                ActiveX controls and Active Setup installed components, this
  3380.                                is typically a GUID string.
  3381.     dwFlags             - [in] Must be 0.
  3382.     psdi                - [in,out] Pointer to SOFTDISTINFO ( see URLMon.h ). May be NULL.
  3383.                                 cbSize should be initialized
  3384.                                 by the caller to sizeof(SOFTDISTINFO), dwReserved should be set to 0.
  3385.  
  3386.     RETURNS:
  3387.  
  3388.     IDNO     - The user chose cancel. If *pbRemind is FALSE, the caller should save the 
  3389.                update version from the SOFTDISTINFO and pass it in as the Advertised
  3390.                version in future calls.
  3391.  
  3392.     IDYES    - The user has selected Update Now/About Update. The caller should navigate to
  3393.                the SOFTDISTINFO's pszHREF to initiate the install or learn about it.
  3394.                The caller should save the update version from the SOFTDISTINFO and pass
  3395.                it in as the Advertised version in future calls.
  3396.  
  3397.     IDIGNORE - There is no pending software update. Note: There is
  3398.                no Ignore button in the standard UI. This occurs if the available
  3399.                version is less than the installed version or is not present or if the
  3400.                Advertised version is greater than or equal to the update version.
  3401.  
  3402.     IDABORT  - An error occured. Call GetSoftwareUpdateInfo() for a more specific HRESULT.
  3403.                Note: There is no Abort button in the standard UI.
  3404. }
  3405.  
  3406. function SoftwareUpdateMessageBox(hWnd: HWND; szDistUnit: PWideChar;
  3407.   dwFlags: DWORD; var psdi: TSoftDistInfo): DWORD; stdcall;
  3408. {$EXTERNALSYM SoftwareUpdateMessageBox}
  3409.  
  3410. implementation
  3411.  
  3412. const
  3413.   shell32 = 'shell32.dll';
  3414.  
  3415. procedure SHAddToRecentDocs;             external shell32 name 'SHAddToRecentDocs';
  3416. function SHBrowseForFolder;          external shell32 name 'SHBrowseForFolderA';
  3417. function SHBrowseForFolderA;          external shell32 name 'SHBrowseForFolderA';
  3418. function SHBrowseForFolderW;          external shell32 name 'SHBrowseForFolderW';
  3419. procedure SHChangeNotify;                external shell32 name 'SHChangeNotify';
  3420. function SHGetDataFromIDList;        external shell32 name 'SHGetDataFromIDListA';
  3421. function SHGetDataFromIDListA;        external shell32 name 'SHGetDataFromIDListA';
  3422. function SHGetDataFromIDListW;        external shell32 name 'SHGetDataFromIDListW';
  3423. function SHGetDesktopFolder;            external shell32 name 'SHGetDesktopFolder';
  3424. function SHGetInstanceExplorer;         external shell32 name 'SHGetInstanceExplorer';
  3425. function SHGetMalloc;                   external shell32 name 'SHGetMalloc';
  3426. function SHGetPathFromIDList;        external shell32 name 'SHGetPathFromIDListA';
  3427. function SHGetPathFromIDListA;        external shell32 name 'SHGetPathFromIDListA';
  3428. function SHGetPathFromIDListW;        external shell32 name 'SHGetPathFromIDListW';
  3429. function SHGetSpecialFolderLocation;    external shell32 name 'SHGetSpecialFolderLocation';
  3430. function SHLoadInProc;                  external shell32 name 'SHLoadInProc';
  3431. function SHGetSpecialFolderPath;     external shell32 name 'SHGetSpecialFolderPathA'
  3432. function SHGetSpecialFolderPathA;     external shell32 name 'SHGetSpecialFolderPathA'
  3433. function SHGetSpecialFolderPathW;     external shell32 name 'SHGetSpecialFolderPathW'
  3434. procedure SHGetSettings;                external shell32 name 'SHGetSettings'
  3435. function SoftwareUpdateMessageBox;      external shell32 name 'SoftwareUpdateMessageBox'
  3436.  
  3437. end.
  3438.  
  3439.  
  3440.